cloudinary 1.2.4 → 1.3.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
  SHA1:
3
- metadata.gz: 842df6412b0805f7245faa594974cd1f154be04c
4
- data.tar.gz: 017cad0657d0f86f6ee178409a598666a2308d7b
3
+ metadata.gz: 675877dafeb654d86f21a603814835b907b0b560
4
+ data.tar.gz: 0afd3a11251a44cbc84293ded02975cd1473b01b
5
5
  SHA512:
6
- metadata.gz: 2f3ee72559c228f8eeed1903894b1d285438939d4a1186a62e10ba1972480ad3c44f707240a52c2d1862b4b1eb2b69fd1e3f7b6a06cdb9b66523e192a40eebff
7
- data.tar.gz: cfc2d22221ab303377dd80230ec72b8886c69c099c175811ab70ce140e9155149d787a67a69b5c3524ea05e149052450b51e69cc20ebb1701b6a8bfdbc19a531
6
+ metadata.gz: d33e51978a4d8e65e5c7bb1463d8fe1c17ffbf8e4c099fb5b9cf4160877e69c6bd60698507e6718d1457ee713b4168d5782058a9399c3f5b67522e3c0bb16e02
7
+ data.tar.gz: 1833b23e9d849a38ddc2d88844d89b33bb903c0e4acfcc6ede358995338df7fbb8922887fd924e96ae6be9f46964db69f3bdfe9f2b45036444d511647eedef0f
data/CHANGELOG.md CHANGED
@@ -1,4 +1,21 @@
1
1
 
2
+ 1.3.0 / 2016-12-22
3
+ ==================
4
+
5
+ New functionality and features
6
+ ------------------------------
7
+
8
+ * Search resource by context
9
+ * Add `:transformations` parameter to all `delete_resources`
10
+ * Update bundled Cloudinary Javascript library to 2.1.8
11
+
12
+ Other Changes
13
+ -------------
14
+
15
+ * Added 'Album' for better showing a real world use case
16
+ * Use tag instead of content_tag when creating input tag
17
+ * Fix `face_coordinates` test
18
+
2
19
  1.2.4 / 2016-10-30
3
20
  ==================
4
21
 
@@ -52,6 +52,15 @@ class Cloudinary::Api
52
52
  call_api(:get, uri, only(options, :next_cursor, :max_results, :tags, :context, :moderations, :direction), options)
53
53
  end
54
54
 
55
+ def self.resources_by_context(key, value=nil, options={})
56
+ resource_type = options[:resource_type] || "image"
57
+ uri = "resources/#{resource_type}/context"
58
+ params = only(options, :next_cursor, :max_results, :tags, :context, :moderations, :direction,:key,:value)
59
+ params[:key] = key
60
+ params[:value] = value
61
+ call_api(:get, uri, params, options)
62
+ end
63
+
55
64
  def self.resources_by_ids(public_ids, options={})
56
65
  resource_type = options[:resource_type] || "image"
57
66
  type = options[:type] || "upload"
@@ -98,27 +107,27 @@ class Cloudinary::Api
98
107
  resource_type = options[:resource_type] || "image"
99
108
  type = options[:type] || "upload"
100
109
  uri = "resources/#{resource_type}/#{type}"
101
- call_api(:delete, uri, { :public_ids => public_ids }.merge(only(options, :keep_original, :invalidate)), options)
110
+ call_api(:delete, uri, delete_resource_params(options, :public_ids => public_ids ), options)
102
111
  end
103
112
 
104
113
  def self.delete_resources_by_prefix(prefix, options={})
105
114
  resource_type = options[:resource_type] || "image"
106
115
  type = options[:type] || "upload"
107
116
  uri = "resources/#{resource_type}/#{type}"
108
- call_api(:delete, uri, { :prefix => prefix }.merge(only(options, :keep_original, :next_cursor, :invalidate)), options)
117
+ call_api(:delete, uri, delete_resource_params(options, :prefix => prefix), options)
109
118
  end
110
119
 
111
120
  def self.delete_all_resources(options={})
112
121
  resource_type = options[:resource_type] || "image"
113
122
  type = options[:type] || "upload"
114
123
  uri = "resources/#{resource_type}/#{type}"
115
- call_api(:delete, uri, { :all => true }.merge(only(options, :keep_original, :next_cursor, :invalidate)), options)
124
+ call_api(:delete, uri, delete_resource_params(options, :all => true ), options)
116
125
  end
117
126
 
118
127
  def self.delete_resources_by_tag(tag, options={})
119
128
  resource_type = options[:resource_type] || "image"
120
129
  uri = "resources/#{resource_type}/tags/#{tag}"
121
- call_api(:delete, uri, only(options, :keep_original, :next_cursor, :invalidate), options)
130
+ call_api(:delete, uri, delete_resource_params(options), options)
122
131
  end
123
132
 
124
133
  def self.delete_derived_resources(derived_resource_ids, options={})
@@ -153,16 +162,16 @@ class Cloudinary::Api
153
162
  end
154
163
 
155
164
  def self.transformation(transformation, options={})
156
- call_api(:get, "transformations/#{transformation_string(transformation)}", only(options, :max_results, :next_cursor), options)
165
+ call_api(:get, "transformations/#{transformation_string(transformation)}", only(options, :next_cursor, :max_results), options)
157
166
  end
158
167
 
159
168
  def self.delete_transformation(transformation, options={})
160
169
  call_api(:delete, "transformations/#{transformation_string(transformation)}", {}, options)
161
170
  end
162
171
 
163
- # updates - supports:
164
- # "allowed_for_strict" boolean
165
- # "unsafe_update" transformation params - updates a named transformation parameters without regenerating existing images
172
+ # updates - supports:
173
+ # "allowed_for_strict" boolean
174
+ # "unsafe_update" transformation params - updates a named transformation parameters without regenerating existing images
166
175
  def self.update_transformation(transformation, updates, options={})
167
176
  params = only(updates, :allowed_for_strict)
168
177
  params[:unsafe_update] = transformation_string(updates[:unsafe_update]) if updates[:unsafe_update]
@@ -173,7 +182,7 @@ class Cloudinary::Api
173
182
  call_api(:post, "transformations/#{name}", { :transformation => transformation_string(definition) }, options)
174
183
  end
175
184
 
176
- # upload presets
185
+ # upload presets
177
186
  def self.upload_presets(options={})
178
187
  call_api(:get, "upload_presets", only(options, :next_cursor, :max_results), options)
179
188
  end
@@ -304,6 +313,10 @@ class Cloudinary::Api
304
313
  result
305
314
  end
306
315
 
316
+ def self.delete_resource_params(options, params ={})
317
+ params.merge(only(options, :keep_original, :next_cursor, :invalidate, :transformations))
318
+ end
319
+
307
320
  def self.transformation_string(transformation)
308
321
  transformation.is_a?(String) ? transformation : Cloudinary::Utils.generate_transformation_string(transformation.clone)
309
322
  end
@@ -229,7 +229,7 @@ module CloudinaryHelper
229
229
  :"data-max-chunk-size"=>options[:chunk_size],
230
230
  :"class" => [html_options[:class], "cloudinary-fileupload"].flatten.compact
231
231
  ).reject{|k,v| v.blank?}
232
- content_tag("input", nil, tag_options)
232
+ tag("input", tag_options)
233
233
  end
234
234
  alias_method :cl_upload_tag, :cl_image_upload_tag
235
235
 
@@ -110,8 +110,9 @@ class Cloudinary::Utils
110
110
  :w => width
111
111
  }
112
112
  {
113
- :ar => :aspect_ratio,
114
113
  :ac => :audio_codec,
114
+ :af => :audio_frequency,
115
+ :ar => :aspect_ratio,
115
116
  :br => :bit_rate,
116
117
  :cs => :color_space,
117
118
  :d => :default_image,
@@ -127,7 +128,6 @@ class Cloudinary::Utils
127
128
  :pg => :page,
128
129
  :q => :quality,
129
130
  :r => :radius,
130
- :af => :audio_frequency,
131
131
  :so => :start_offset,
132
132
  :sp => :streaming_profile,
133
133
  :vc => :video_codec,
@@ -363,7 +363,7 @@ class Cloudinary::Utils
363
363
  end
364
364
 
365
365
  prefix = unsigned_download_url_prefix(source, cloud_name, private_cdn, cdn_subdomain, secure_cdn_subdomain, cname, secure, secure_distribution)
366
- source = [prefix, resource_type, type, signature, transformation, version, source].reject(&:blank?).join("/")
366
+ source = [prefix, resource_type, type, signature, transformation, version, source].reject(&:blank?).join("/")
367
367
  end
368
368
 
369
369
  def self.finalize_source(source, format, url_suffix)
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.2.4"
3
+ VERSION = "1.3.0"
4
4
  end
data/spec/api_spec.rb CHANGED
@@ -12,9 +12,11 @@ describe Cloudinary::Api do
12
12
  before(:all) do
13
13
 
14
14
  @api = Cloudinary::Api
15
- Cloudinary::Uploader.upload("spec/logo.png", :public_id => test_id_1, :tags => [TEST_TAG, TIMESTAMP_TAG], :context => "key=value", :eager =>[:width =>100, :crop =>:scale])
16
- Cloudinary::Uploader.upload("spec/logo.png", :public_id => test_id_2, :tags => [TEST_TAG, TIMESTAMP_TAG], :context => "key=value", :eager =>[:width =>100, :crop =>:scale])
17
- Cloudinary::Uploader.upload("spec/logo.png", :public_id => test_id_3, :tags => [TEST_TAG, TIMESTAMP_TAG], :context => "key=value", :eager =>[:width =>100, :crop =>:scale])
15
+ Cloudinary::Uploader.upload(TEST_IMG, :public_id => test_id_1, :tags => [TEST_TAG, TIMESTAMP_TAG], :context => "key=value", :eager =>[:width =>100, :crop =>:scale])
16
+ Cloudinary::Uploader.upload(TEST_IMG, :public_id => test_id_2, :tags => [TEST_TAG, TIMESTAMP_TAG], :context => "key=value", :eager =>[:width =>100, :crop =>:scale])
17
+ Cloudinary::Uploader.upload(TEST_IMG, :public_id => test_id_3, :tags => [TEST_TAG, TIMESTAMP_TAG], :context => "key=value", :eager =>[:width =>100, :crop =>:scale])
18
+ Cloudinary::Uploader.upload(TEST_IMG, :public_id => test_id_1, :tags => [TEST_TAG, TIMESTAMP_TAG], :context => "test-key=test", :eager =>[:width =>100, :crop =>:scale])
19
+ Cloudinary::Uploader.upload(TEST_IMG, :public_id => test_id_3, :tags => [TEST_TAG, TIMESTAMP_TAG], :context => "test-key=tasty", :eager =>[:width =>100, :crop =>:scale])
18
20
  end
19
21
 
20
22
  after(:all) do
@@ -75,6 +77,13 @@ describe Cloudinary::Api do
75
77
  expect(resources.map{|resource| resource["context"]}).to include({"custom" => {"key" => "value"}})
76
78
  end
77
79
 
80
+ it "should allow listing resources by context" do
81
+ resources = @api.resources_by_context('test-key')["resources"]
82
+ expect(resources.count).to eq(2)
83
+ resources = @api.resources_by_context('test-key','test')["resources"]
84
+ expect(resources.count).to eq(1)
85
+ end
86
+
78
87
  it "should allow listing resources by public ids" do
79
88
  resources = @api.resources_by_ids([test_id_1, test_id_2], :tags => true, :context => true)["resources"]
80
89
  expect(resources.length).to eq(2)
@@ -152,6 +161,19 @@ describe Cloudinary::Api do
152
161
  @api.delete_resources(["apit_test", "test_id_2", "api_test3"])
153
162
  end
154
163
 
164
+ it "should allow deleting resource transformations" do
165
+ resource = Cloudinary::Uploader.upload(TEST_IMG, :eager => [{:width=>101,:crop=>:scale}, {:width=>200,:crop=>:crop}])
166
+ public_id = resource["public_id"]
167
+ expect(resource).not_to be_blank
168
+ derived = resource["eager"].map{|d| d["transformation"]}
169
+ expect(derived).to include("c_scale,w_101", "c_crop,w_200")
170
+ @api.delete_resources([public_id], :transformations => "c_crop,w_200")
171
+ resource = @api.resource(public_id)
172
+ derived = resource["derived"].map{|d| d["transformation"]}
173
+ expect(derived).not_to include("c_crop,w_200")
174
+ expect(derived).to include("c_scale,w_101")
175
+ end
176
+
155
177
  it "should allow deleting resources by prefix" do
156
178
  expect(RestClient::Request).to receive(:execute).with(deep_hash_value( {[:payload, :prefix] => "api_test_by"}))
157
179
  @api.delete_resources_by_prefix("api_test_by")
@@ -300,7 +322,7 @@ describe Cloudinary::Api do
300
322
 
301
323
  # this test must be last because it deletes (potentially) all dependent transformations which some tests rely on. Excluded by default.
302
324
  skip "should allow deleting all resources", :delete_all=>true do
303
- Cloudinary::Uploader.upload("spec/logo.png", :public_id=>"api_test5", :eager=>[:width=>101,:crop=>:scale], :tags => [TEST_TAG, TIMESTAMP_TAG])
325
+ Cloudinary::Uploader.upload(TEST_IMG, :public_id=>"api_test5", :eager=>[:width=>101,:crop=>:scale], :tags => [TEST_TAG, TIMESTAMP_TAG])
304
326
  resource = @api.resource("api_test5")
305
327
  expect(resource).not_to be_blank
306
328
  expect(resource["derived"].length).to eq(1)
@@ -311,7 +333,7 @@ describe Cloudinary::Api do
311
333
  end
312
334
 
313
335
  it "should support setting manual moderation status" do
314
- result = Cloudinary::Uploader.upload("spec/logo.png", {:moderation => :manual, :tags => [TEST_TAG, TIMESTAMP_TAG]})
336
+ result = Cloudinary::Uploader.upload(TEST_IMG, {:moderation => :manual, :tags => [TEST_TAG, TIMESTAMP_TAG]})
315
337
  expect(result["moderation"][0]["status"]).to eq("pending")
316
338
  expect(result["moderation"][0]["kind"]).to eq("manual")
317
339
  api_result = Cloudinary::Api.update(result["public_id"], {:moderation_status => :approved})
@@ -325,7 +347,7 @@ describe Cloudinary::Api do
325
347
  end
326
348
 
327
349
  it "should support requesting categorization" do
328
- result = Cloudinary::Uploader.upload("spec/logo.png", :tags => [TEST_TAG, TIMESTAMP_TAG])
350
+ result = Cloudinary::Uploader.upload(TEST_IMG, :tags => [TEST_TAG, TIMESTAMP_TAG])
329
351
  expect{Cloudinary::Api.update(result["public_id"], {:categorization => :illegal})}.to raise_error(Cloudinary::Api::BadRequest, /^Illegal value/)
330
352
  end
331
353
 
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,10 @@ require 'rspec/version'
4
4
  require 'rest_client'
5
5
 
6
6
  TEST_IMAGE_URL = "http://cloudinary.com/images/old_logo.png"
7
+ TEST_IMG = "spec/logo.png"
8
+ TEST_IMG_W = 241
9
+ TEST_IMG_H = 51
10
+
7
11
  TEST_TAG = 'cloudinary_gem_test'
8
12
  TIMESTAMP_TAG = "#{TEST_TAG}_#{rand(999999999)}_#{RUBY_VERSION}_#{ defined? Rails::version ? Rails::version : 'no_rails'}"
9
13
 
@@ -9,10 +9,6 @@ describe Cloudinary::Uploader do
9
9
  break puts("Please setup environment for api test to run") if Cloudinary.config.api_secret.blank?
10
10
  include_context "cleanup", TIMESTAMP_TAG
11
11
 
12
- TEST_IMG = "spec/logo.png"
13
- TEST_IMG_W = 241
14
- TEST_IMG_H = 51
15
-
16
12
  it "should successfully upload file" do
17
13
  result = Cloudinary::Uploader.upload(TEST_IMG, :tags => [TEST_TAG, TIMESTAMP_TAG])
18
14
  expect(result["width"]).to eq(TEST_IMG_W)
@@ -172,8 +168,9 @@ describe Cloudinary::Uploader do
172
168
 
173
169
  it "should allow sending face coordinates" do
174
170
  coordinates = [[120, 30, 109, 150], [121, 31, 110, 151]]
171
+ result_coordinates = [[120, 30, 109, 51], [121, 31, 110, 51]]
175
172
  result = Cloudinary::Uploader.upload(TEST_IMG, { :face_coordinates => coordinates, :faces => true, :tags => [TEST_TAG, TIMESTAMP_TAG]})
176
- expect(result["faces"]).to eq(coordinates)
173
+ expect(result["faces"]).to eq(result_coordinates)
177
174
 
178
175
  different_coordinates = [[122, 32, 111, 152]]
179
176
  Cloudinary::Uploader.explicit(result["public_id"], {:face_coordinates => different_coordinates, :faces => true, :type => "upload", :tags => [TEST_TAG, TIMESTAMP_TAG]})
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * Cloudinary's JavaScript library - Version 2.1.5
3
+ * Cloudinary's JavaScript library - Version 2.1.8
4
4
  * Copyright Cloudinary
5
5
  * see https://github.com/cloudinary/cloudinary_js
6
6
  *
@@ -30,7 +30,7 @@ var slice = [].slice,
30
30
  /*
31
31
  * Includes common utility methods and shims
32
32
  */
33
- var ArrayParam, BaseUtil, Cloudinary, CloudinaryJQuery, Condition, Configuration, HtmlTag, ImageTag, Layer, LayerParam, Param, RangeParam, RawParam, SubtitlesLayer, TextLayer, Transformation, TransformationBase, TransformationParam, Util, VideoTag, addClass, allStrings, camelCase, cloneDeep, cloudinary, compact, contains, convertKeys, crc32, defaults, difference, functions, getAttribute, getData, hasClass, identity, isEmpty, isNumberLike, isString, m, merge, parameters, reWords, removeAttribute, setAttribute, setAttributes, setData, smartEscape, snakeCase, utf8_encode, webp, width, withCamelCaseKeys, withSnakeCaseKeys, without;
33
+ var ArrayParam, BaseUtil, ClientHintsMetaTag, Cloudinary, CloudinaryJQuery, Condition, Configuration, HtmlTag, ImageTag, Layer, LayerParam, Param, RangeParam, RawParam, SubtitlesLayer, TextLayer, Transformation, TransformationBase, TransformationParam, Util, VideoTag, addClass, allStrings, camelCase, cloneDeep, cloudinary, compact, contains, convertKeys, crc32, defaults, difference, functions, getAttribute, getData, hasClass, identity, isEmpty, isNumberLike, isString, m, merge, parameters, reWords, removeAttribute, setAttribute, setAttributes, setData, smartEscape, snakeCase, utf8_encode, webp, width, withCamelCaseKeys, withSnakeCaseKeys, without;
34
34
  allStrings = function(list) {
35
35
  var item, j, len;
36
36
  for (j = 0, len = list.length; j < len; j++) {
@@ -342,7 +342,7 @@ var slice = [].slice,
342
342
  /**
343
343
  * @class Util
344
344
  */
345
- Util = $.extend(BaseUtil, {
345
+ Util = jQuery.extend(BaseUtil, {
346
346
  hasClass: hasClass,
347
347
  addClass: addClass,
348
348
  getAttribute: getAttribute,
@@ -1360,7 +1360,6 @@ var slice = [].slice,
1360
1360
 
1361
1361
  /**
1362
1362
  * Defaults configuration.
1363
- * @const {Object} Configuration.DEFAULT_CONFIGURATION_PARAMS
1364
1363
  */
1365
1364
  var DEFAULT_CONFIGURATION_PARAMS, ref;
1366
1365
 
@@ -1470,22 +1469,38 @@ var slice = [].slice,
1470
1469
  */
1471
1470
 
1472
1471
  Configuration.prototype.fromEnvironment = function() {
1473
- var cloudinary_url, k, ref1, ref2, uri, v;
1472
+ var cloudinary_url, j, k, len, query, ref1, ref2, ref3, uri, uriRegex, v, value;
1474
1473
  cloudinary_url = typeof process !== "undefined" && process !== null ? (ref1 = process.env) != null ? ref1.CLOUDINARY_URL : void 0 : void 0;
1475
1474
  if (cloudinary_url != null) {
1476
- uri = require('url').parse(cloudinary_url, true);
1477
- this.configuration = {
1478
- cloud_name: uri.host,
1479
- api_key: uri.auth && uri.auth.split(":")[0],
1480
- api_secret: uri.auth && uri.auth.split(":")[1],
1481
- private_cdn: uri.pathname != null,
1482
- secure_distribution: uri.pathname && uri.pathname.substring(1)
1483
- };
1484
- if (uri.query != null) {
1485
- ref2 = uri.query;
1486
- for (k in ref2) {
1487
- v = ref2[k];
1488
- this.configuration[k] = v;
1475
+ uriRegex = /cloudinary:\/\/(?:(\w+)(?:\:(\w+))?@)?([\w\.-]+)(?:\/([^?]*))?(?:\?(.+))?/;
1476
+ uri = uriRegex.exec(cloudinary_url);
1477
+ if (uri) {
1478
+ if (uri[3] != null) {
1479
+ this.configuration['cloud_name'] = uri[3];
1480
+ }
1481
+ if (uri[1] != null) {
1482
+ this.configuration['api_key'] = uri[1];
1483
+ }
1484
+ if (uri[2] != null) {
1485
+ this.configuration['api_secret'] = uri[2];
1486
+ }
1487
+ if (uri[4] != null) {
1488
+ this.configuration['private_cdn'] = uri[4] != null;
1489
+ }
1490
+ if (uri[4] != null) {
1491
+ this.configuration['secure_distribution'] = uri[4];
1492
+ }
1493
+ query = uri[5];
1494
+ if (query != null) {
1495
+ ref2 = query.split('&');
1496
+ for (j = 0, len = ref2.length; j < len; j++) {
1497
+ value = ref2[j];
1498
+ ref3 = value.split('='), k = ref3[0], v = ref3[1];
1499
+ if (v == null) {
1500
+ v = true;
1501
+ }
1502
+ this.configuration[k] = v;
1503
+ }
1489
1504
  }
1490
1505
  }
1491
1506
  }
@@ -1994,7 +2009,7 @@ var slice = [].slice,
1994
2009
  continue;
1995
2010
  }
1996
2011
  attrName = /^html_/.test(key) ? key.slice(5) : key;
1997
- options[Util.camelCase(attrName)] = value;
2012
+ options[attrName] = value;
1998
2013
  }
1999
2014
  ref1 = this.keys();
2000
2015
  for (j = 0, len = ref1.length; j < len; j++) {
@@ -2166,7 +2181,7 @@ var slice = [].slice,
2166
2181
  };
2167
2182
 
2168
2183
  Transformation.prototype.delay = function(value) {
2169
- return this.param(value, "delay", "l");
2184
+ return this.param(value, "delay", "dl");
2170
2185
  };
2171
2186
 
2172
2187
  Transformation.prototype.density = function(value) {
@@ -2862,11 +2877,43 @@ var slice = [].slice,
2862
2877
 
2863
2878
  return VideoTag;
2864
2879
 
2880
+ })(HtmlTag);
2881
+
2882
+ /**
2883
+ * Image Tag
2884
+ * Depends on 'tags/htmltag', 'cloudinary'
2885
+ */
2886
+ ClientHintsMetaTag = (function(superClass) {
2887
+ extend(ClientHintsMetaTag, superClass);
2888
+
2889
+
2890
+ /**
2891
+ * Creates an HTML (DOM) Meta tag that enables client-hints.
2892
+ * @constructor ClientHintsMetaTag
2893
+ * @extends HtmlTag
2894
+ */
2895
+
2896
+ function ClientHintsMetaTag(options) {
2897
+ ClientHintsMetaTag.__super__.constructor.call(this, 'meta', void 0, Util.assign({
2898
+ "http-equiv": "Accept-CH",
2899
+ content: "DPR, Viewport-Width, Width"
2900
+ }, options));
2901
+ }
2902
+
2903
+
2904
+ /** @override */
2905
+
2906
+ ClientHintsMetaTag.prototype.closeTag = function() {
2907
+ return "";
2908
+ };
2909
+
2910
+ return ClientHintsMetaTag;
2911
+
2865
2912
  })(HtmlTag);
2866
2913
  Cloudinary = (function() {
2867
2914
  var AKAMAI_SHARED_CDN, CF_SHARED_CDN, DEFAULT_POSTER_OPTIONS, DEFAULT_VIDEO_SOURCE_TYPES, OLD_AKAMAI_SHARED_CDN, SHARED_CDN, VERSION, absolutize, applyBreakpoints, cdnSubdomainNumber, closestAbove, cloudinaryUrlPrefix, defaultBreakpoints, finalizeResourceType, findContainerWidth, maxWidth, updateDpr;
2868
2915
 
2869
- VERSION = "2.1.5";
2916
+ VERSION = "2.1.8";
2870
2917
 
2871
2918
  CF_SHARED_CDN = "d3jpl91pxevbkh.cloudfront.net";
2872
2919
 
@@ -3055,7 +3102,7 @@ var slice = [].slice,
3055
3102
  */
3056
3103
 
3057
3104
  Cloudinary.prototype.url = function(publicId, options) {
3058
- var prefix, ref, resourceTypeAndType, transformation, transformationString, url, version;
3105
+ var error, error1, prefix, ref, resourceTypeAndType, transformation, transformationString, url, version;
3059
3106
  if (options == null) {
3060
3107
  options = {};
3061
3108
  }
@@ -3088,7 +3135,12 @@ var slice = [].slice,
3088
3135
  publicId = encodeURIComponent(publicId).replace(/%3A/g, ':').replace(/%2F/g, '/');
3089
3136
  }
3090
3137
  } else {
3091
- publicId = encodeURIComponent(decodeURIComponent(publicId)).replace(/%3A/g, ':').replace(/%2F/g, '/');
3138
+ try {
3139
+ publicId = decodeURIComponent(publicId);
3140
+ } catch (error1) {
3141
+ error = error1;
3142
+ }
3143
+ publicId = encodeURIComponent(publicId).replace(/%3A/g, ':').replace(/%2F/g, '/');
3092
3144
  if (options.url_suffix) {
3093
3145
  if (options.url_suffix.match(/[\.\/]/)) {
3094
3146
  throw 'url_suffix should not include . or /';
@@ -4048,6 +4100,9 @@ var slice = [].slice,
4048
4100
  value = upload_params[key];
4049
4101
  if (Util.isPlainObject(value)) {
4050
4102
  upload_params[key] = jQuery.map(value, function(v, k) {
4103
+ if (Util.isString(v)) {
4104
+ v = v.replace(/[\|=]/g, "\\$&");
4105
+ }
4051
4106
  return k + '=' + v;
4052
4107
  }).join('|');
4053
4108
  } else if (Util.isArray(value)) {
@@ -4088,11 +4143,12 @@ var slice = [].slice,
4088
4143
  HtmlTag: HtmlTag,
4089
4144
  ImageTag: ImageTag,
4090
4145
  VideoTag: VideoTag,
4146
+ ClientHintsMetaTag: ClientHintsMetaTag,
4091
4147
  Layer: Layer,
4092
4148
  TextLayer: TextLayer,
4093
4149
  SubtitlesLayer: SubtitlesLayer,
4094
4150
  Cloudinary: Cloudinary,
4095
- VERSION: "2.1.5",
4151
+ VERSION: "2.1.8",
4096
4152
  CloudinaryJQuery: CloudinaryJQuery
4097
4153
  };
4098
4154
  return cloudinary;
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.2.4
4
+ version: 1.3.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: 2016-10-30 00:00:00.000000000 Z
13
+ date: 2016-12-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws_cf_signer