normalize_to_source should strip out query-string params
bradgessler opened this issue · comments
Rails will sometimes feed a query param into the image_path helper (for example, image_path('pic.gif', :mouseover => 'foo.gif'), which causes an error in asset fingerprint. The following patch fixes the problem:
--- a/vendor/plugins/asset_fingerprint/lib/asset_fingerprint/asset.rb
+++ b/vendor/plugins/asset_fingerprint/lib/asset_fingerprint/asset.rb
@@ -66,6 +66,8 @@ module AssetFingerprint
end
def self.normalize_to_source(source_or_absolute_path)
+ # Rails will sometimes feed a query string through here and screw up paths
+ source_or_absolute_path = source_or_absolute_path.split('?').first
if absolute_path?(source_or_absolute_path)
source = to_relative(source_or_absolute_path)
else
Thanks for the fix Brad - much appreciated - its been committed to Asset Fingerprint, cheers, Eliot