Skip to content

Commit

Permalink
Fix .jpeg precompile issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiculescu committed Feb 11, 2023
1 parent 925fb65 commit 411f18d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprockets/blob/master/UPGRADING.md

- Fix for precompile issues when multiple extensions map to the same MIME type (eg. `.jpeg` / `.jpg`). [#781](https://github.com/rails/sprockets/pull/781)

## 4.2.0

- Rack 3 compatibility. [#758](https://github.com/rails/sprockets/pull/758)
Expand Down
4 changes: 3 additions & 1 deletion lib/sprockets/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ def load_from_unloaded(unloaded)
end

if type = unloaded.params[:type]
logical_path += config[:mime_types][type][:extensions].first
extensions = config[:mime_types][type][:extensions]
extension = extensions.include?(extname) ? extname : extensions.first
logical_path += extension
end

if type != file_type && !config[:transformers][file_type][type]
Expand Down

0 comments on commit 411f18d

Please sign in to comment.