cloudinary 1.22.0 → 1.23.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4ba1d838324b0f283f26a61ae3f1a208d81883abbe181dba68c519bac3a3a08
4
- data.tar.gz: e5e2465d95e0a5aeb5cdf340f0d6763745475dd82f9e828d8b6d39380b833fbc
3
+ metadata.gz: 5eb49ce85c34e632ed20f09a8600694177bf8f82c8490ff5463554c0ab4b3b2e
4
+ data.tar.gz: cf2558234f2c9c5dac2de81d2ef2060432a36297a50728f9f01df8997de2805d
5
5
  SHA512:
6
- metadata.gz: 1cee80dca707cc686d4a26de17c4e1ada511d34a052c0205436f092082def7ff4defba0705ce4dad5a36bf50512dbcec5886ac09fb94e9932bcafde010b5bd78
7
- data.tar.gz: 9c86c99dffb906973c0da80f699fcd66c8a48afc31290c6bbba40307ec20e3a9fe81a0ee25315918a556c00abcce30ad33dc0a84074a30814d219b308fcb5862
6
+ metadata.gz: 33147b3fb85715a5472259c06d636a29b45df54eee79d56677b2d2eca846b999e8452e4f6f0661bc9c198ad776d0313f64fb8444075c46fbec789463a2107c22
7
+ data.tar.gz: fc33de4ab89ec6bc63be65bad25fcbd0344975e8344ef29ecb365f9dd93c9bf7d6e611f96f8f60cd3d08cc222d308e6b04c27b835d4d9672b1c529821337dee2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ 1.23.0 / 2022-04-05
2
+ ==================
3
+
4
+ New functionality and features
5
+ ------------------------------
6
+
7
+ * Add support for multiple ACLs in `AuthToken`
8
+ * Add support for disable b-frames for video codec
9
+ * Add support for aliases in Configuration
10
+ * Add support for `filename` upload parameter
11
+
12
+ Other Changes
13
+ -------------
14
+
15
+ * Fix escaping of special characters in `public_id`
16
+ * Fix support of the lowercase response headers
17
+ * Fix CarrierWave file retrieval after store
18
+
1
19
  1.22.0 / 2022-02-17
2
20
  ==================
3
21
 
@@ -21,7 +21,12 @@ module Cloudinary
21
21
  start = options[:start_time]
22
22
  expiration = options[:expiration]
23
23
  ip = options[:ip]
24
+
24
25
  acl = options[:acl]
26
+ if acl.present?
27
+ acl = acl.is_a?(String) ? [acl] : acl
28
+ end
29
+
25
30
  duration = options[:duration]
26
31
  url = options[:url]
27
32
  start = Time.new.getgm.to_i if start == 'now'
@@ -41,9 +46,9 @@ module Cloudinary
41
46
  token << "ip=#{ip}" if ip
42
47
  token << "st=#{start}" if start
43
48
  token << "exp=#{expiration}"
44
- token << "acl=#{escape_to_lower(acl)}" if acl
49
+ token << "acl=#{escape_to_lower(acl.join('!'))}" if acl && acl.size > 0
45
50
  to_sign = token.clone
46
- to_sign << "url=#{escape_to_lower(url)}" if url && acl.blank?
51
+ to_sign << "url=#{escape_to_lower(url)}" if url && (acl.blank? || acl.size == 0)
47
52
  auth = digest(to_sign.join(SEPARATOR), key)
48
53
  token << "hmac=#{auth}"
49
54
  "#{name}=#{token.join(SEPARATOR)}"
@@ -19,9 +19,12 @@ module Cloudinary::BaseApi
19
19
  # This sets the instantiated self as the response Hash
20
20
  update Cloudinary::Api.parse_json_response response
21
21
 
22
- @rate_limit_allowed = response.headers[:x_featureratelimit_limit].to_i if response.headers[:x_featureratelimit_limit]
23
- @rate_limit_reset_at = Time.parse(response.headers[:x_featureratelimit_reset]) if response.headers[:x_featureratelimit_reset]
24
- @rate_limit_remaining = response.headers[:x_featureratelimit_remaining].to_i if response.headers[:x_featureratelimit_remaining]
22
+ # According to RFC 2616, header names are case-insensitive.
23
+ lc_headers = response.headers.transform_keys(&:downcase)
24
+
25
+ @rate_limit_allowed = lc_headers[:x_featureratelimit_limit].to_i if lc_headers[:x_featureratelimit_limit]
26
+ @rate_limit_reset_at = Time.parse(lc_headers[:x_featureratelimit_reset]) if lc_headers[:x_featureratelimit_reset]
27
+ @rate_limit_remaining = lc_headers[:x_featureratelimit_remaining].to_i if lc_headers[:x_featureratelimit_remaining]
25
28
  end
26
29
  end
27
30
  end
@@ -154,8 +154,16 @@ module Cloudinary::CarrierWave
154
154
  format = Cloudinary::PreloadedFile.split_format(original_filename || "").last
155
155
  return format || "" if resource_type == "raw"
156
156
  format = requested_format || format || default_format
157
-
157
+
158
158
  format = format.to_s.downcase
159
159
  Cloudinary::FORMAT_ALIASES[format] || format
160
160
  end
161
+
162
+ def store!(new_file=nil)
163
+ super
164
+
165
+ column = model.send(:_mounter, mounted_as).send(:serialization_column)
166
+ identifier = model.send(:attribute, column)
167
+ retrieve_from_store!(identifier) unless identifier.nil?
168
+ end
161
169
  end
@@ -114,6 +114,9 @@ class Cloudinary::Uploader
114
114
  else
115
115
  filename = "cloudinaryfile"
116
116
  end
117
+
118
+ filename = options[:filename] if options[:filename]
119
+
117
120
  unique_upload_id = Cloudinary::Utils.random_public_id
118
121
  upload = nil
119
122
  index = 0
@@ -885,7 +885,7 @@ class Cloudinary::Utils
885
885
 
886
886
  # Based on CGI::unescape. In addition keeps '+' character as is
887
887
  def self.smart_unescape(string)
888
- CGI.unescape(string.sub('+', '%2B'))
888
+ CGI.unescape(string.gsub('+', '%2B'))
889
889
  end
890
890
 
891
891
  def self.random_public_id
@@ -1185,9 +1185,10 @@ class Cloudinary::Utils
1185
1185
 
1186
1186
  # A video codec parameter can be either a String or a Hash.
1187
1187
  #
1188
- # @param [Object] param <code>vc_<codec>[ : <profile> : [<level>]]</code>
1188
+ # @param [Object] param <code>vc_<codec>[ : <profile> : [<level> : [<b_frames>]]]</code>
1189
1189
  # or <code>{ codec: 'h264', profile: 'basic', level: '3.1' }</code>
1190
- # @return [String] <code><codec> : <profile> : [<level>]]</code> if a Hash was provided
1190
+ # or <code>{ codec: 'h265', profile: 'auto', level: 'auto', b_frames: false }</code>
1191
+ # @return [String] <code><codec> : <profile> : [<level> : [<b_frames>]]]</code> if a Hash was provided
1191
1192
  # or the param if a String was provided.
1192
1193
  # Returns NIL if param is not a Hash or String
1193
1194
  # @private
@@ -1201,6 +1202,9 @@ class Cloudinary::Utils
1201
1202
  video.concat ":" + param[:profile]
1202
1203
  if param.has_key? :level
1203
1204
  video.concat ":" + param[:level]
1205
+ if param.has_key?(:b_frames) && param[:b_frames] === false
1206
+ video.concat ":bframes_no"
1207
+ end
1204
1208
  end
1205
1209
  end
1206
1210
  end
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.22.0"
3
+ VERSION = "1.23.0"
4
4
  end
data/lib/cloudinary.rb CHANGED
@@ -145,7 +145,18 @@ module Cloudinary
145
145
  #
146
146
  # @return [OpenStruct]
147
147
  def self.import_settings_from_file
148
- OpenStruct.new((YAML.load(ERB.new(IO.read(config_dir.join("cloudinary.yml"))).result)[config_env] rescue {}))
148
+ yaml_env_config = begin
149
+ yaml_source = ERB.new(IO.read(config_dir.join("cloudinary.yml"))).result
150
+ yaml_config = if YAML.respond_to?(:safe_load)
151
+ YAML.safe_load(yaml_source, aliases: true)
152
+ else
153
+ YAML.load(yaml_source)
154
+ end
155
+ yaml_config[config_env]
156
+ rescue StandardError
157
+ {}
158
+ end
159
+ OpenStruct.new(yaml_env_config)
149
160
  end
150
161
 
151
162
  private_class_method :import_settings_from_file
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.22.0
4
+ version: 1.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nadav Soferman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-02-17 00:00:00.000000000 Z
13
+ date: 2022-04-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws_cf_signer