anaconda 0.12.2 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dcafa5a609c883cdcf985429b9aab24b03cae591
4
- data.tar.gz: cbd055fbc2b06b2f600124b9eb18a8e52c8ab959
3
+ metadata.gz: 0912b73bf2811535a108eb6315c0308ac787edd3
4
+ data.tar.gz: 784348799ded4aa0c2acfbadef522a07f0c162d5
5
5
  SHA512:
6
- metadata.gz: 0a385e5a061bd3984b987889eee017280694cc3b53c038384d6ec65986cbaecd1c11970fbe7fd50d96866246b9a19ca624f9f57df3b900a9ef8376a176dc8ab9
7
- data.tar.gz: a2dd2c03211f869cb9ce1827ef95bf4245223f90314b4b259838a77dbfa5dabaaf358fb4f1ef7a88899186d2b95a59e3888da0cd7c9488aa2838856718c62ca3
6
+ metadata.gz: c2cc3a99a5dfa431fec05e20c1750640df6643e86767545e8a4f9a6b38630b763d09726fdcc8c2b3b7c2c12375cc8a6495dd852406e8241ba493c5e621cefdf8
7
+ data.tar.gz: ade3196bcab7786bc36f104149c2aea8a65e8a707ae960e8f9c7a4b0083c4dbe37be023860d17c0e49ed716bf6082aebd15a5d88865761262c230e254b99b285
data/README.markdown CHANGED
@@ -179,6 +179,9 @@ We highly recommend the `figaro` gem [https://github.com/laserlemon/figaro](http
179
179
  `asset_download_url` will return a signed S3 URL with content-disposition set to attachment so the file will be downloaded instead of opened in the browser.
180
180
 
181
181
  ## Changelog
182
+ * 0.13.0
183
+ * Set Content-Type for S3 file to match that of the uploaded source file.
184
+
182
185
  * 0.12.2
183
186
  * Fix bug introduced in 0.12.1
184
187
  * Wrap hidden fields in the anaconda_dropzone div (to fix bug)
@@ -152,7 +152,6 @@ class @AnacondaUploadField
152
152
  $( @element_id ).fileupload
153
153
  dropZone: $( @element_id ).parent(".anaconda_dropzone"),
154
154
  add: (e, data) ->
155
- DLog data
156
155
  self.file_selected data
157
156
  progress: (e, data) ->
158
157
  DLog data
@@ -216,10 +215,13 @@ class @AnacondaUploadField
216
215
  false
217
216
 
218
217
  file_selected: (data) ->
218
+ DLog "file_selected"
219
219
  DLog data
220
220
  if @is_allowed_type(data.files[0])
221
221
  @file = data.files[0]
222
222
  @file_data = data
223
+ @set_content_type()
224
+
223
225
  DLog @file
224
226
  @upload_details_container.html "<div id='upload_file_#{@get_id()}' class='upload-file #{@get_media_type(@file)}'><span class='file-name'>#{@file.name}</span><span class='size'>#{@readable_size()}</span><span class='progress-percent'></span><div class='progress'><span class='progress-bar'></span></div></div>"
225
227
 
@@ -230,6 +232,15 @@ class @AnacondaUploadField
230
232
  DLog "Not auto upload"
231
233
  else
232
234
  alert "#{data.files[0].name} is a #{@get_media_type(data.files[0])} file. Only #{@allowed_types.join(", ")} files are allowed."
235
+
236
+ set_content_type: ->
237
+ form_data = $(@element_id).data('form-data')
238
+ form_data["Content-Type"] = @file.type
239
+
240
+ $( @element_id ).fileupload(
241
+ formData: form_data
242
+ )
243
+
233
244
  get_id: ->
234
245
  hex_md5( "#{@file.name} #{@file.size}" )
235
246
 
@@ -93,6 +93,7 @@ module Anaconda
93
93
  {
94
94
  :key => key,
95
95
  :acl => @options[:acl],
96
+ "Content-Type" => "application/octet-stream",
96
97
  :policy => policy,
97
98
  :signature => signature,
98
99
  "AWSAccessKeyId" => @options[:aws_access_key_id],
@@ -121,6 +122,7 @@ module Anaconda
121
122
  conditions: [
122
123
  #["starts-with", "$utf8", ""],
123
124
  ["starts-with", "$key", base_key],
125
+ ["starts-with", "$Content-Type", ""],
124
126
  ["content-length-range", 1, @options[:max_file_size]],
125
127
  {bucket: @options[:bucket]},
126
128
  {acl: @options[:acl]}
@@ -1,5 +1,5 @@
1
1
  module Anaconda
2
2
  module Rails
3
- VERSION = "0.12.2"
3
+ VERSION = "0.13.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anaconda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben McFadden