-
Notifications
You must be signed in to change notification settings - Fork 788
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
4.0.1: New etag behavior can cause overlong URLs/tags and also nil crashes #682
Comments
Heroku build log:
|
Confirm that bug. Can't run rails app after upgrading to 4.0.1. (Ruby 2.7.1, Rails 6.0.1.3)
|
app also crashes if |
found this thread thanks got I was loosing my mind. |
Thank you for reporting. Could you please try the master branch to see if it is fixed? I'll release 4.0.2 when it is confirmed. |
4.0.2 released |
Thank you for the fast turn-around on this! |
Expected behavior
Generated etags and production asset URLs should contain the file hash, but the hash should be some kind of sensible length like 64 characters.
Actual behavior
In Sprockets 4.0.1, this commit changed etag generation so that it involves the
environment_version
But end-users control this variable (like with
Rails.config.assets.version
), and it can be any string ornil
that probably won't.pack()
properly.For example, I discovered this bug because we were setting our
config.assets.version
to a hexadecimal string. A hash wasn't generated properly, so we got this final URL:Also you can set the
environment_version
tonil
downstream and it will blow up.System configuration
Example
Possible Solution
I'm not sure exactly what was desired from this change, but perhaps you should coerce the
environment_version
into a binary string before generating the etags?The text was updated successfully, but these errors were encountered: