rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
542 stars 96 forks source link

Problem with handling the Data URI in foundation.css #170

Closed flajann2 closed 10 years ago

flajann2 commented 10 years ago

Generates an exception when handling the data URI in foundation.css

/* Add height value for select elements to match text input height */
select {
  -webkit-appearance: none !important;
  background-color: #fafafa;
  background-image: url("data:image/svg+xml;base64, PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iM3B4IiB2aWV3Qm94PSIwIDAgNiAzIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA2IDMiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwb2x5Z29uIHBvaW50cz0iNS45OTIsMCAyLjk5MiwzIC0wLjAwOCwwICIvPjwvc3ZnPg==");
  background-repeat: no-repeat;
  background-position: 97% center;
  border: 1px solid #cccccc;
  padding: 0.5rem;
  font-size: 0.875rem;
  border-radius: 0;
  height: 2.3125rem; }
  select.radius {
    border-radius: 3px; }
  select:hover {
    background-color: #f3f3f3;
    border-color: #999999; }

Causes the following exception:

URI::InvalidURIError - bad URI(is not URI?): data:image/svg+xml;base64, PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iM3B4IiB2aWV3Qm94PSIwIDAgNiAzIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA2IDMiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwb2x5Z29uIHBvaW50cz0iNS45OTIsMCAyLjk5MiwzIC0wLjAwOCwwICIvPjwvc3ZnPg==:
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/2.1.0/uri/common.rb:176:in `split'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/2.1.0/uri/common.rb:211:in `parse'
D, [2014-04-29T15:50:46.650405 #10662] DEBUG -- : [Barista] Copying all javascripts
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/2.1.0/uri/common.rb:747:in `parse'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/css.rb:8:in `block in preproc'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/css.rb:7:in `gsub'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/css.rb:7:in `preproc'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/helpers.rb:49:in `asset_filter_css'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/class_methods.rb:79:in `block (3 levels) in add_individual_routes!'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/tilt-1.4.1/lib/tilt.rb:127:in `fetch'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/class_methods.rb:79:in `block (2 levels) in add_individual_routes!'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1602:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1602:in `block in compile!'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `[]'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (3 levels) in route!'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:985:in `route_eval'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (2 levels) in route!'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1006:in `block in process_route'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `catch'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `process_route'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:964:in `block in route!'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `each'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `route!'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1076:in `block in dispatch!'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1073:in `dispatch!'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `block in call!'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `call!'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:886:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/barista-1.3.0/lib/barista/server.rb:33:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/barista-1.3.0/lib/barista/filter.rb:16:in `_call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/barista-1.3.0/lib/barista/filter.rb:9:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/logger.rb:15:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/commonlogger.rb:33:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:217:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:210:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/show_exceptions.rb:21:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:86:in `block in pre_process'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:84:in `catch'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:84:in `pre_process'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in `call'
    /home/trader/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in `block in spawn_threadpool'
j15e commented 10 years ago

Should be fixed by #167

j15e commented 10 years ago

Just published 0.3.3