Skip to content

Commit

Permalink
handle non-gzip pathnames in publish
Browse files Browse the repository at this point in the history
  • Loading branch information
albertsun committed Aug 10, 2016
1 parent f457897 commit 43bcca0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/s3-publisher.rb
Expand Up @@ -121,10 +121,13 @@ def publish_from_queue
begin
gzip = item[:gzip] != false && !item[:write_opts][:content_type].match('image/')

if item[:contents].is_a?(Pathname)
item[:contents] = item[:contents].read
end

if gzip
item[:write_opts][:content_encoding] = 'gzip'
gzip_body = item[:contents].is_a?(Pathname) ? item[:contents].read : item[:contents]
item[:contents] = gzip(gzip_body)
item[:contents] = gzip(item[:contents])
end

write_opts = {
Expand Down

0 comments on commit 43bcca0

Please sign in to comment.