rails / sprockets

Rack-based asset packaging system
MIT License
932 stars 792 forks source link

Fix `.jpeg` precompile issue #781

Closed ghiculescu closed 1 year ago

ghiculescu commented 1 year ago

Fixes https://github.com/rails/sprockets-rails/issues/304

There is a replication app available at https://github.com/ghiculescu/sprocketsdemo. When that repo is pointed to this PR, the tests pass.

The issue was that in development (using HelperAssetResolvers::Environment in sprockets-rails), it would gracefully handle the jpeg/jpg confusion. But when precompiling, it would only write a .jpg file. Then in production (using HelperAssetResolvers::Manifest in sprockets-rails) it would error as no .jpeg file exists.

There's several PRs linked from https://github.com/rails/sprockets-rails/issues/304 where people have had to rename files from jpeg to jpg to work around this. That workaround is fine, the problem is that it only breaks in production so people typically find the issue when production breaks.