Skip to content

Conversation

@mikevoets
Copy link

Our precompilation using sprockets-rails was skipping over processing asset urls that refer to assets inside app/assets/images/data.

This caused it to not resolve assets referenced in with for example url('data/foo.png') function calls and replace them with the digested paths.

This was caused by the regular expression in Sprockets::Rails::AssetUrlProcessor::REGEX, which wrongfully considered assets in data/ directories to be data: protocol assets.

This PR fixes the regex to not skip over url() function calls referring to assets in data/ directories and only skip when the data or http(s) protocol in the url is followed by a colon.

This bug caused our precompilation to skip over processing asset urls that refer to assets inside app/assets/images/data.
@mikevoets
Copy link
Author

Closing because we have a workaround and we will be moving on from sprockets soon.

@mikevoets mikevoets closed this Mar 25, 2025
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.

1 participant