Skip to content
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

Fix asset url processor regex for where subdirectory starts with 'data' #543

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.
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