cloudinary 1.0.80 → 1.0.81

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: 5238e148e2fa359ac4736ba85dd244cf72b9fbc5
4
- data.tar.gz: cd495901ce6334177179ebfd39036959dce421d4
3
+ metadata.gz: 22f7163efe3beefab6b2653a0c3e440f45907eee
4
+ data.tar.gz: 4a446807c4be6d7769384adebc9a2b08fe910d1c
5
5
  SHA512:
6
- metadata.gz: be187c5e89b243c0ba3fad8efafe605898e12a23758fa4e0a9526f79928ce2028eeadf7da3136a0d481200d5f39564cb4c3c2aaf3d09fecb71d2ee6a3c120433
7
- data.tar.gz: e5b09d564ce2e161311bf555559857d36e51d08b9e15294fbb9a78b11c18e7baa4f6727d37d2093b921ced8547ad94a31a8eb15c221e1e265581bceff0331251
6
+ metadata.gz: 70ea68172f8e246e74049e87ce49e49af856dc7428fdc68b635a3fa6f886c32c656fe625fa31051665da3c2037e7bac85f17e710d973bdbcb586e9969235b433
7
+ data.tar.gz: 3663bde9f91c9d51b6760e1383f200d731425c63aad59520b508f6cd333f4793875bd79a361e5f1be126a65291c57833539054302fc6991cc56be6275a391109
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ = Version 1.0.81 - 2015-01-08
2
+ * CarrierWave - support default_format if format is unknown, support arbitrary format for resource_type raw.
3
+
1
4
  = Version 1.0.80 - 2015-01-01
2
5
  * Support upload_chunked direct upload for large raw files.
3
6
 
@@ -60,7 +60,7 @@ module Cloudinary::CarrierWave
60
60
 
61
61
  def filename
62
62
  return nil if self.blank?
63
- return [self.full_public_id, self.format].join(".")
63
+ return [self.full_public_id, self.format].reject(&:blank?).join(".")
64
64
  end
65
65
 
66
66
  # default public_id to use if no uploaded file. Override with public_id of an uploaded image if you want a default image.
@@ -176,8 +176,12 @@ module Cloudinary::CarrierWave
176
176
  return Cloudinary::PreloadedFile.split_format(identifier)
177
177
  end
178
178
 
179
+ def default_format
180
+ "png"
181
+ end
182
+
179
183
  def resource_type
180
- Cloudinary::Utils.resource_type_for_format(self.filename || self.format)
184
+ Cloudinary::Utils.resource_type_for_format(requested_format || original_filename || default_format)
181
185
  end
182
186
 
183
187
  # For the given methods - versions should call the main uploader method
@@ -135,7 +135,7 @@ module Cloudinary::CarrierWave
135
135
  @tags
136
136
  end
137
137
 
138
- def format
138
+ def requested_format
139
139
  format_processor = self.all_processors.find{|processor| processor[0] == :convert}
140
140
  if format_processor
141
141
  # Explicit format is given
@@ -146,11 +146,15 @@ module Cloudinary::CarrierWave
146
146
  # No local format. The reset should be handled by main uploader
147
147
  uploader = self.model.send(self.mounted_as)
148
148
  format = uploader.format
149
- else
150
- # Try to auto-detect format
151
- format = Cloudinary::PreloadedFile.split_format(original_filename || "").last
152
- format ||= "png" # TODO Default format?
153
149
  end
150
+ format
151
+ end
152
+
153
+ def format
154
+ format = Cloudinary::PreloadedFile.split_format(original_filename || "").last
155
+ return format || "" if resource_type == "raw"
156
+ format = requested_format || format || default_format
157
+
154
158
  format = format.to_s.downcase
155
159
  Cloudinary::FORMAT_ALIASES[format] || format
156
160
  end
@@ -35,7 +35,6 @@ class Cloudinary::CarrierWave::Storage < ::CarrierWave::Storage::Abstract
35
35
  params[:type]=uploader.class.storage_type
36
36
 
37
37
  params[:resource_type] ||= :auto
38
-
39
38
  uploader.metadata = Cloudinary::Uploader.upload(data, params)
40
39
  if uploader.metadata["error"]
41
40
  raise Cloudinary::CarrierWave::UploadError.new(uploader.metadata["error"]["message"], uploader.metadata["error"]["http_code"])
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.80"
3
+ VERSION = "1.0.81"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudinary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.80
4
+ version: 1.0.81
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nadav Soferman
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2015-01-01 00:00:00 Z
14
+ date: 2015-01-08 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client