lib/locomotive/dragonfly.rb in locomotive_cms-2.5.0 vs lib/locomotive/dragonfly.rb in locomotive_cms-2.5.1

- old
+ new

@@ -23,11 +23,11 @@ file = nil if source.is_a?(String) || source.is_a?(Hash) # simple string or theme asset source = source['url'] if source.is_a?(Hash) - source.strip! + clean_source!(source) if source =~ /^http/ file = self.app.fetch_url(source) else file = self.app.fetch_file(File.join('public', source)) @@ -45,9 +45,19 @@ file end def self.app ::Dragonfly.app + end + + protected + + def self.clean_source!(source) + # remove the leading / trailing whitespaces + source.strip! + + # remove the query part (usually, timestamp) if local file + source.sub!(/(\?.*)$/, '') unless source =~ /^http/ end end end \ No newline at end of file