rstacruz/sinatra-assetpack — pull request #167 by chancerussell (2014-04-20 03:46:06+00:00)
Title: Skip CSS preprocessing for malformed URIs 

The regex in css.rb that checks for URLs (for cache busting?) will match
some URLs that URI.parse considers invalid. This came up with a file
from zurb/foundation that contained a space in a data:image URI. SASS
and browsers seem to handle the space fine, but URI.parse throws an
InvalidURIError.

My solution was to wrap the call and return the match unchanged if
InvalidURIError is thrown. Another solution might be to change '(.s*)'
in the regex to '(\S*)', but that would only fix the issue with
whitespace--it seems preferable to just pass any string that URI.parse
can't handle unchanged, then catch it in SASS if it's actually going to
cause a problem.

Pull request #152 attempts to fix the same issue, but would skip
anything where the url starts with "data:", which doesn't seem like what
we want to do.

I've also added tests to preproc_test.rb for the fix, and a bad_uri.scss
file that contains data that shows the issue.