Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring up to speed with base #1

Open
wants to merge 86 commits into
base: master
Choose a base branch
from
Open

Bring up to speed with base #1

wants to merge 86 commits into from

Conversation

jbosse
Copy link
Member

@jbosse jbosse commented Dec 27, 2022

No description provided.

dmeremyanin and others added 30 commits February 14, 2016 22:58
On my machine, this spec fails a bit more than half the time: it
requests the one filetype, and gets the other content-type header.

Many thanks to @treznick for the bones of this spec, even though it
turned out a bit differently in the end.
This is a minimal fix. A more thorough fix might refactor the internals
of `#call` and its helpers to not rely on instance variables or mutable
state, but that would make it harder to tell whether threadsaftey, or
some other change, was the real bug.

This fix is borrowed from
ContinuityControl@7c183c7

For more info, read:
* https://ieftimov.com/writing-rails-middleware#thread-safety
* http://stackoverflow.com/questions/23028226/rack-middleware-and-thread-safety

Fixes #358.
The spec seems to be testing that the middleware's `@render_pdf` is
reset after each request. The spec now fails, because all of the
middleware's instance variables are, from the outside, irrelevant: they
only matter for the `dup` instance, which is GC'd right away.

I never like to delete a spec that starts to fail after a refactoring,
but I think it's OK here, because:
* the behavior the spec looks for is ensured by the threadsafety spec I
  added
* this spec exemplifies the problem with rack middleware: relying on
  mutable state
Change "of" to "or"
Fixes #385.

This was added in error, as part of #344, in
2febadc.

The `PDFKit` constructor _does_ support a `protocol` option, but
`PDFKit::Configuration` doesn't.
Allow PDFKit middleware to receive javascript delay option
…eadme

Remove `config.protocol` from the README.
* Remove support for Ruby < 2.2

* Add new wkhtmltopdf package for Travis build

* Version bump

* Add CHANGELOG notes
Update activesupport, remove Ruby 1.9.2 compatibility
Allows users to catch one error which all PDFkit errors are subclasses of
Update to wkhtmltopdf-binary-edge as wkhtmltopdf-binary gem is deprecated
serene and others added 30 commits July 5, 2020 18:11
Add missing require statements for tempfile
Only grab last line of bundle exec which output
Return 500 status when an exception is caught in middleware
* Update download url for wkhtmltopdf
* Version bump to 0.8.4.3
Limits the handling of exceptions to those occurring in the PDF generation logic,
handling errors from @app.call(env) has the side-effect of burying errors which may
be raised legitimately by other middlewares.
* Add github action to automatically draft release notes

* Fix release drafter action
* Drop legacy Ruby versions

They are currently unmaintained.

* Run CI against multiple Rails versions

* Add failing spec on Rails 6.0

* Use `ActiveSupport::SafeBuffer#html_safe` if it is available

PDFKit concats HTML. So, it should not be escaped.

* Document supported versions

Now, pdfkit supports Ruby 2.5 or later.
This allows fature detection in application code.

- Before
```
$ ruby -I ./lib -r pdfkit -e 'puts PDFKit::VERSION'
Traceback (most recent call last):
-e:1:in `<main>': uninitialized constant PDFKit::VERSION (NameError)
```

- After
```
$ ruby -I ./lib -r pdfkit -e 'puts PDFKit::VERSION'
0.8.4.3.2
```
* Version bump to 0.8.5
* Initial commit

* Update wkhtmltopdf setup

* Build against multiple Rails versions

* Add Ruby 2.5
- Update default ruby version to latest 2.6 release.
- Test Ruby 2.7, 3.0, and 3.1, and Rails 6.1 and 7.0.
  Use versions as strings to make sure 3.0 tests 3.0.
- Use latest rubygems and bundler to fix the bundler cache.
- Exclude incompatible test matrix combinations.
- Show Ruby deprecation warnings in tests where supported.
- File.exists? is deprecated; use File.exist?.
- URI.escape and URI.decode are deprecated.
- Add frozen string literal comments.
- Make sure constants are frozen.
- Make sure that the code is frozen-string safe.
- Adjust dev dependencies for Ruby 3.0+ compatibility.
- Fix Ruby warnings in pdfkit_spec.rb
- Comment out bad syntax in release-drafter action.

Fixes #498
* fix: support non-lower-case Content-Type header provided by app

The changes in #511 change what headers get set by PDFKit
and make all headers set by PDFKit lower-case.

However, the changes also affect code depending on headers
set by the app - which for Rack 2.x apps will be 'Content-Type'.

To address this, the code should check if Content-Type is present
and in that case use it, otherwise default to content-type.

As the code also sets this header (changing the content type
to 'application/pdf'), it should set the same header that
the original value is retrieved from.

So decide on the exact header name first, store it in the
'content_type_header' variable, and use it to index the
headers dict.

Fix #515.

* rspec: add tests for mixed case Content-Type header support

As rack 3.x outright rejects mixed case headers, this test has to be marked
as pending - but passes (without the pending flag) with rack 2.x.

* rspec/content-type: make mixed case test pending only on Rack>=3.0.0
* By calling `IO.popen` with an Array of command arguments
  (ex: `['ls', '-l', ...]`) it runs the command as a separate process
  instead of running it in a sub-shell as a shell command. This prevents
  any arbitrary command injection or env variable interpolation, without
  needing complex shell-escaping logic.
  https://ruby-doc.org/core-3.1.2/IO.html#method-c-popen
* Changed `Configuration#executable` to return a String or an Array for
  when xvfb mode is enabled.
* Changed `PDFKit#command` to return an Array of command arguments for
  `IO.popen`.
* Removed argument quoting logic as it's not necessary when calling
  `IO.popen` with an Array of arguments.
* Rewrote some specs to test if the command's Array of arguments contains
  specific argument values.
* Added a custom RSpec `contain` matcher for testing if an expected Array
  exists within another Array.
* use another complex key example

* check if build issue is a corrupted cache problem?

* Revert "check if build issue is a corrupted cache problem?"

This reverts commit 77c075b.

* swap to default rubygem to avoid 2.5 version issue

* did i break the cache again?

* Revert "did i break the cache again?"

This reverts commit c3fcf24.

* config runner to grab valid rubygem-update for 2.5

* jankessay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.