lib/sinatra/exstatic_assets.rb in sinatra-exstatic-assets-2.0.0 vs lib/sinatra/exstatic_assets.rb in sinatra-exstatic-assets-2.0.1

- old
+ new

@@ -135,16 +135,17 @@ # @option options [TrueClass] :script_tag Whether to prepend the SCRIPT_TAG env variable. # @return [String] # @see Sinatra::Helpers#uri def sss_url_for(addr, options=nil) options ||= {} - absolute = options.delete :absolute + opts = {timestamp: true}.merge options + absolute = opts.delete :absolute absolute = false if absolute.nil? - script_tag = options.delete(:script_tag) - script_tag = true if script_tag.nil? + script_tag = opts.delete(:script_tag) + script_tag = true if script_tag.nil? unless addr.is_uri? href = uri addr, absolute, script_tag - addr.respond_to?(:querystring) ? + addr.respond_to?(:querystring) && opts[:timestamp] ? "#{href}#{addr.querystring}" : href end @@ -191,11 +192,14 @@ end # Make's sure the options don't get mixed up with the other args. def sss_extract_options(a) - opts = a.last.respond_to?(:keys) ? a.pop : {} + opts = a.last.respond_to?(:keys) ? + a.pop : + {} + opts ||= {} [a, opts] end # @see #sss_stylesheet_tag @@ -281,10 +285,11 @@ source = "favicon.ico" if source.nil? or source.empty? # xhtml style like <link rel="shortcut icon" href="http://example.com/myicon.ico" /> options[:rel] ||= settings.xhtml ? "shortcut icon" : "icon" - options[:href] = sss_url_for(source, options.delete(:url_options)) + url_options = options.delete(:url_options) || {} + options[:href] = sss_url_for(Asset.new(source), url_options.merge(timestamp: false)) Tag.new "link", options end alias_method :link_favicon_tag, :favicon_tag