Permalink
Browse files

Fixing to match Cloudfront invalidation spec

  • Loading branch information...
1 parent 3dead94 commit 21f0095bb98a91c70cfac9dfd2ee877c5a3e36dc @gauravgupta123 gauravgupta123 committed Apr 16, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/jammit/s3_uploader.rb
View
8 lib/jammit/s3_uploader.rb
@@ -97,7 +97,7 @@ def upload_from_glob(glob)
log "file has not changed: #{remote_path}"
end
end
- if Jammit.configuration[:use_cloudfront] && @changed_files.present?
+ if Jammit.configuration[:use_cloudfront] && !@changed_files.empty?
log "invalidating cloudfront cache for changed files"
invalidate_cache(@changed_files)
end
@@ -123,7 +123,7 @@ def invalidate_cache(files)
paths = ""
files.each do |key|
log "adding #{key} to list of invalidation requests"
- paths += "<Path>#{key}</Path>"
+ paths += "<Path>/#{key}</Path>"
end
digest = HMAC::SHA1.new(@secret_access_key)
digest << date = Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S %Z")
@@ -139,7 +139,7 @@ def invalidate_cache(files)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
res = http.request(req)
- log res.code == 201 ? 'Invalidation request succeeded' : "Failed #{res.code}"
+ log res.code == "201" ? 'Invalidation request succeeded' : "Failed #{res.code}"
end
def log(msg)
@@ -148,4 +148,4 @@ def log(msg)
end
-end
+end

0 comments on commit 21f0095

Please sign in to comment.