Skip to content

Loading…

With old version of fog - needs to use file#save for custom headers #1

Merged
merged 1 commit into from

2 participants

@juwalter

... since file#create does not accept options hash, and internally ignores custom headers anyway

@juwalter juwalter Calls 'save' explicitly on Rackspace::File
... in order to allow for custom headers
e9e5304
@cfcosta cfcosta merged commit fc6d98b into cfcosta:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 5, 2012
  1. @juwalter

    Calls 'save' explicitly on Rackspace::File

    juwalter committed
    ... in order to allow for custom headers
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/asset_sync/storage.rb
View
9 lib/asset_sync/storage.rb
@@ -154,14 +154,17 @@ def upload_file(f)
log "Uploading: #{f}"
end
- bucket.files.create(file) unless ignore
+ unless ignore
+ file_object = bucket.files.new(file)
+ file_object.save(custom_headers(file))
+ end
end
- def add_custom_headers(file)
+ def custom_headers(file)
headers = config.custom_headers.select { |(key, _)| file[:key] =~ key }
return unless headers
- headers.values.each { |h| file.merge! h }
+ headers.values.inject({}) {|hsh,v| hsh.merge!(v); hsh }
end
def upload_files
Something went wrong with that request. Please try again.