lib/imgix/client.rb in imgix-0.3.1 vs lib/imgix/client.rb in imgix-0.3.2
- old
+ new
@@ -24,11 +24,15 @@
end
def sign_path(path)
uri = Addressable::URI.parse(path)
query = (uri.query || '')
- signature = Digest::MD5.hexdigest(@token + uri.path + '?' + query)
- "#{@secure ? 'https' : 'http'}://#{get_host(path)}#{uri.path}?#{query}&s=#{signature}"
+ path = "#{@secure ? 'https' : 'http'}://#{get_host(path)}#{uri.path}?#{query}"
+ if @token
+ signature = Digest::MD5.hexdigest(@token + uri.path + '?' + query)
+ path += "&s=#{signature}"
+ end
+ return path
end
def get_host(path)
host = host_for_crc(path) if @shard_strategy == :crc
host = host_for_cycle if @shard_strategy == :cycle