-
Notifications
You must be signed in to change notification settings - Fork 247
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
JPEG extension is now forced to JPG #304
JPEG extension is now forced to JPG #304
Comments
Perhaps this is related to #246. In case this saves someone else some time and head-scratching, I was getting
from tests when rendering a view with a It's also worth noting that if you follow the advice in the warning and add the resource to your precompile list, that does not help. |
Lost a few hours of my life to this issue lol |
It turns out that image_tag turns a jpeg extension in the path into a jpg extension [1], but sprockets doesn't change the actual image file name, so you get a Sprockets::Rails::Helper::AssetNotFound exception. Hopefully this should fix the problem. [1]: rails/sprockets-rails#304
I don't think it was intentional. Does anyone have a super small https://www.codetriage.com/example_app that shows this issue? |
jpeg files are not happy in production environment See rails/sprockets-rails#304
@schneems I came across this issue in my hobby app today. I have stripped out everything apart from what is needed to demonstrate the issue, and I've put it in this repo: https://github.com/david-mears/jpeg-issue-demo/ I deployed it to https://sheltered-beach-99525.herokuapp.com/, which is up at the time of writing. Heroku hobby apps sleep when they haven't been touched for 30 minutes, so give it a minute to wake up. I don't fully understand CodeTriage, so I'm not sure if I managed to submit it there. Through trial and error, I discovered that only files ending .jpeg cause errors such as the below from my heroku logs:
The bug can be 'fixed' either by renaming jpegs to jpgs, or by setting config.assets.compile = true |
The link I provided has instructions on making an example app it looks like github didn't expand the link.
To note: this will have performance issues and also opened a directory traversal security issue in an older version of sprockets. Thanks for the app! |
jpeg files are not happy in production environment See rails/sprockets-rails#304
As reported above, for me breaks in production, but works fine in development. If you have an asset ending in
This is terribly confusing, not really documented anywhere as far as I know, and I just spent a few hours figuring it out -- and I am a very experienced Rails user. It would be acceptable (if not ideal) if it failed in both development and production, if That this is a long-running bug is making me question Sprockets viability. |
Took me a while to find this out! Anybody who can point me to the reason behind this? And totally agree with @jrochkind , it should atleast be warned about - especially given that it is not the same behaviour in development. |
This issue drove me insane today 😅 |
Got me, too today. We just migrated away from Webpacker to jsbundling-rails with webpack and Sprockets. Per @jrochkind, at minimum the development experience should mirror production. Nothing worse than everything working great locally (where it's safe to fail) only to have it fail on production. |
I think rails/sprockets#781 will fix this issue. |
A bug from January 2016 is still biting people today? |
Until 2.3.3, it was ok to have files JPEG using .jpeg or .jpg as extension.
From 3.0, JPEG are automatically converted to .jpg (both with actual precompilation and sandbox precompile errors). If you have something like image_tag('image.jpeg'), it breaks with the AssestNotPrecompiled error. Renaming the file to image.jpg will fix it.
Not a big deal for developers, refactoring filenames not a big ask :), just worth noting if this was not intentional.
The text was updated successfully, but these errors were encountered: