cloudinary 1.13.2 → 1.14.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 +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +42 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +21 -0
- data/CHANGELOG.md +19 -0
- data/cloudinary.gemspec +16 -2
- data/lib/active_storage/service/cloudinary_service.rb +19 -4
- data/lib/cloudinary.rb +1 -1
- data/lib/cloudinary/carrier_wave/remote.rb +1 -1
- data/lib/cloudinary/cloudinary_controller.rb +2 -4
- data/lib/cloudinary/railtie.rb +6 -2
- data/lib/cloudinary/uploader.rb +1 -1
- data/lib/cloudinary/utils.rb +9 -2
- data/lib/cloudinary/version.rb +1 -1
- data/vendor/assets/javascripts/cloudinary/jquery.cloudinary.js +2 -2
- metadata +10 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74a24f6c79eb085bd0f6bccdf71bfba55cf83b5f27f31153681af45e207a6090
|
|
4
|
+
data.tar.gz: 3d2ed94607da0f4edd8cebb48c281f4a53483ac6d6952ca5002b656a4906dfe1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fc3d2a7de323d029a24f4fe19069aee0f44deb6fd325fd1b0387d77045dcab2fdaa1f05edeb650f49a0a93150af2e7019e9098506567f7e7ea91b20a312cd3b5
|
|
7
|
+
data.tar.gz: e111b64de35d948c5fcb316d21a9123e779e9be6701de3b58fa2a49604eb73693ac200d1f13f3145b92e4b7892fb107ab663729472d0ec029bfd5b206a9d857e
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Bug report for Cloudinary Ruby SDK
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: const-cloudinary
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Bug report for Cloudinary Ruby SDK
|
|
11
|
+
Before proceeding, please update to latest version and test if the issue persists
|
|
12
|
+
|
|
13
|
+
## Describe the bug in a sentence or two.
|
|
14
|
+
…
|
|
15
|
+
|
|
16
|
+
## Issue Type (Can be multiple)
|
|
17
|
+
[ ] Build - Can’t install or import the SDK
|
|
18
|
+
[ ] Performance - Performance issues
|
|
19
|
+
[ ] Behaviour - Functions aren’t working as expected (Such as generate URL)
|
|
20
|
+
[ ] Documentation - Inconsistency between the docs and behaviour
|
|
21
|
+
[ ] Other (Specify)
|
|
22
|
+
|
|
23
|
+
## Steps to reproduce
|
|
24
|
+
… if applicable
|
|
25
|
+
|
|
26
|
+
## Error screenshots or Stack Trace (if applicable)
|
|
27
|
+
…
|
|
28
|
+
|
|
29
|
+
## Operating System
|
|
30
|
+
[ ] Linux
|
|
31
|
+
[ ] Windows
|
|
32
|
+
[ ] OSX
|
|
33
|
+
[ ] All
|
|
34
|
+
|
|
35
|
+
## Environment and Libraries (fill in the version numbers)
|
|
36
|
+
Cloudinary Ruby SDK version - 0.0.0
|
|
37
|
+
Ruby Version - 0.0.0
|
|
38
|
+
Rails Version - 0.0.0
|
|
39
|
+
Other Libraries (Carrierwave, ActiveStorage, etc) - 0.0.0
|
|
40
|
+
|
|
41
|
+
## Repository
|
|
42
|
+
If possible, please provide a link to a reproducible repository that showcases the problem
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Feature request for Cloudinary Ruby SDK
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: const-cloudinary
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Feature request for Cloudinary Ruby SDK
|
|
11
|
+
…(If your feature is for other SDKs, please request them there)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Explain your use case
|
|
15
|
+
… (A high level explanation of why you need this feature)
|
|
16
|
+
|
|
17
|
+
## Describe the problem you’re trying to solve
|
|
18
|
+
… (A more technical view of what you’d like to accomplish, and how this feature will help you achieve it)
|
|
19
|
+
|
|
20
|
+
## Do you have a proposed solution?
|
|
21
|
+
… (yes, no? Please elaborate if needed)
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
|
|
2
|
+
1.14.0 / 2020-05-06
|
|
3
|
+
===================
|
|
4
|
+
|
|
5
|
+
New functionality and features
|
|
6
|
+
------------------------------
|
|
7
|
+
|
|
8
|
+
* Add support of global folder in ActiveStorage
|
|
9
|
+
* Add duration to conditions in video
|
|
10
|
+
|
|
11
|
+
Other Changes
|
|
12
|
+
-------------
|
|
13
|
+
|
|
14
|
+
* Fix `URI.unescape is obsolete` warning
|
|
15
|
+
* Fix lingering Rails 6 autoload warnings
|
|
16
|
+
* Fix Ruby 1.9 CI build
|
|
17
|
+
* Allow setting uploader timeout to `nil`
|
|
18
|
+
* Update link to CarrierWave integration
|
|
19
|
+
* Update issue templates
|
|
20
|
+
|
|
2
21
|
1.13.2 / 2020-01-19
|
|
3
22
|
===================
|
|
4
23
|
|
data/cloudinary.gemspec
CHANGED
|
@@ -24,11 +24,25 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
|
|
25
25
|
s.add_development_dependency "actionpack"
|
|
26
26
|
s.add_development_dependency "nokogiri"
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
if RUBY_VERSION >= "2.2.0"
|
|
29
|
+
s.add_development_dependency "rake", ">= 13.0.1"
|
|
30
|
+
else
|
|
31
|
+
s.add_development_dependency "rake", "<= 12.2.1"
|
|
32
|
+
end
|
|
33
|
+
|
|
28
34
|
s.add_development_dependency "sqlite3"
|
|
29
35
|
s.add_development_dependency "rspec", '>=3.5'
|
|
30
36
|
s.add_development_dependency "rails", "~>5.2" if RUBY_VERSION >= "2.2.2"
|
|
37
|
+
|
|
38
|
+
s.add_development_dependency "railties", "<= 4.2.7" if RUBY_VERSION <= "1.9.3"
|
|
31
39
|
s.add_development_dependency "rspec-rails"
|
|
40
|
+
|
|
32
41
|
s.add_development_dependency "rubyzip", "<=1.2.0" # support testing Ruby 1.9
|
|
33
|
-
|
|
42
|
+
|
|
43
|
+
if RUBY_VERSION <= "2.4.0"
|
|
44
|
+
s.add_development_dependency "simplecov", "<= 0.17.1" # support testing Ruby 1.9
|
|
45
|
+
else
|
|
46
|
+
s.add_development_dependency "simplecov", "> 0.18.0"
|
|
47
|
+
end
|
|
34
48
|
end
|
|
@@ -12,6 +12,15 @@ unless ActiveStorage::Blob.method_defined? :original_key
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
+
module CloudinaryHelper
|
|
16
|
+
alias cloudinary_url_internal_original cloudinary_url_internal
|
|
17
|
+
|
|
18
|
+
def cloudinary_url_internal(source, options = {})
|
|
19
|
+
source = ActiveStorage::Blob.service.public_id(source) if defined? ActiveStorage::Blob.service.public_id
|
|
20
|
+
cloudinary_url_internal_original(source, options)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
15
24
|
module ActiveStorage
|
|
16
25
|
class Service::CloudinaryService < Service
|
|
17
26
|
module Headers
|
|
@@ -31,7 +40,7 @@ module ActiveStorage
|
|
|
31
40
|
options = @options.merge(options)
|
|
32
41
|
Cloudinary::Uploader.upload(
|
|
33
42
|
io,
|
|
34
|
-
public_id:
|
|
43
|
+
public_id: public_id_internal(key),
|
|
35
44
|
resource_type: resource_type(io, key),
|
|
36
45
|
context: {active_storage_key: key, checksum: checksum},
|
|
37
46
|
extra_headers: extra_headers,
|
|
@@ -61,7 +70,7 @@ module ActiveStorage
|
|
|
61
70
|
def url_for_direct_upload(key, **options)
|
|
62
71
|
instrument :url, key: key do |payload|
|
|
63
72
|
options = {:resource_type => resource_type(nil, key)}.merge(@options.merge(options.symbolize_keys))
|
|
64
|
-
options[:public_id] =
|
|
73
|
+
options[:public_id] = public_id_internal(key)
|
|
65
74
|
options[:context] = {active_storage_key: key}
|
|
66
75
|
options.delete(:file)
|
|
67
76
|
payload[:url] = api_uri("upload", options)
|
|
@@ -137,13 +146,19 @@ module ActiveStorage
|
|
|
137
146
|
|
|
138
147
|
end
|
|
139
148
|
|
|
149
|
+
def public_id(key)
|
|
150
|
+
return key unless @options[:folder]
|
|
151
|
+
|
|
152
|
+
File.join(@options.fetch(:folder), public_id_internal(key))
|
|
153
|
+
end
|
|
154
|
+
|
|
140
155
|
private
|
|
141
156
|
|
|
142
157
|
def api_uri(action, options)
|
|
143
158
|
base_url = Cloudinary::Utils.cloudinary_api_url(action, options)
|
|
144
159
|
upload_params = Cloudinary::Uploader.build_upload_params(options)
|
|
145
160
|
|
|
146
|
-
upload_params.reject! {|k, v| Cloudinary::Utils.safe_blank?(v)}
|
|
161
|
+
upload_params.reject! { |k, v| Cloudinary::Utils.safe_blank?(v) }
|
|
147
162
|
unless options[:unsigned]
|
|
148
163
|
upload_params = Cloudinary::Utils.sign_request(upload_params, options)
|
|
149
164
|
end
|
|
@@ -173,7 +188,7 @@ module ActiveStorage
|
|
|
173
188
|
@formats[content_type]
|
|
174
189
|
end
|
|
175
190
|
|
|
176
|
-
def
|
|
191
|
+
def public_id_internal(key)
|
|
177
192
|
# TODO: Allow custom manipulation of key to obscure how we store in Cloudinary
|
|
178
193
|
key
|
|
179
194
|
end
|
data/lib/cloudinary.rb
CHANGED
|
@@ -4,7 +4,7 @@ module Cloudinary::CarrierWave
|
|
|
4
4
|
if respond_to?(:process_uri)
|
|
5
5
|
uri = process_uri(uri)
|
|
6
6
|
else # Backward compatibility with old CarrierWave
|
|
7
|
-
uri = URI.parse(
|
|
7
|
+
uri = URI.parse(Utils.smart_escape(Utils.smart_unescape(uri)))
|
|
8
8
|
end
|
|
9
9
|
return if uri.to_s.blank?
|
|
10
10
|
self.original_filename = @cache_id = @filename = File.basename(uri.path).gsub(/[^a-zA-Z0-9\.\-\+_]/, '')
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
module Cloudinary::CloudinaryController
|
|
2
2
|
protected
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
def valid_cloudinary_response?
|
|
5
5
|
received_signature = request.query_parameters[:signature]
|
|
6
6
|
calculated_signature = Cloudinary::Utils.api_sign_request(
|
|
7
7
|
request.query_parameters.select{|key, value| [:public_id, :version].include?(key.to_sym)},
|
|
8
8
|
Cloudinary.config.api_secret)
|
|
9
9
|
return received_signature == calculated_signature
|
|
10
|
-
end
|
|
10
|
+
end
|
|
11
11
|
end
|
|
12
|
-
|
|
13
|
-
ActionController::Base.send :include, Cloudinary::CloudinaryController
|
data/lib/cloudinary/railtie.rb
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
class Cloudinary::Railtie < Rails::Railtie
|
|
2
2
|
rake_tasks do
|
|
3
3
|
Dir[File.join(File.dirname(__FILE__),'../tasks/*.rake')].each { |f| load f }
|
|
4
|
-
end
|
|
4
|
+
end
|
|
5
5
|
config.after_initialize do |app|
|
|
6
6
|
ActionView::Base.send :include, CloudinaryHelper
|
|
7
7
|
end
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
ActiveSupport.on_load(:action_controller_base) do
|
|
10
|
+
ActionController::Base.send :include, Cloudinary::CloudinaryController
|
|
11
|
+
end
|
|
12
|
+
end
|
data/lib/cloudinary/uploader.rb
CHANGED
|
@@ -317,7 +317,7 @@ class Cloudinary::Uploader
|
|
|
317
317
|
params[:signature] = Cloudinary::Utils.api_sign_request(params.reject { |k, v| non_signable.include?(k) }, api_secret)
|
|
318
318
|
params[:api_key] = api_key
|
|
319
319
|
end
|
|
320
|
-
timeout = options
|
|
320
|
+
timeout = options.fetch(:timeout) { Cloudinary.config.to_h.fetch(:timeout, 60) }
|
|
321
321
|
|
|
322
322
|
result = nil
|
|
323
323
|
|
data/lib/cloudinary/utils.rb
CHANGED
|
@@ -42,6 +42,8 @@ class Cloudinary::Utils
|
|
|
42
42
|
"page_x" => "px",
|
|
43
43
|
"page_y" => "py",
|
|
44
44
|
"tags" => "tags",
|
|
45
|
+
"initial_duration" => "idu",
|
|
46
|
+
"duration" => "du",
|
|
45
47
|
"width" => "w"
|
|
46
48
|
}
|
|
47
49
|
|
|
@@ -563,7 +565,7 @@ class Cloudinary::Utils
|
|
|
563
565
|
source = smart_escape(source)
|
|
564
566
|
source_to_sign = source
|
|
565
567
|
else
|
|
566
|
-
source = smart_escape(
|
|
568
|
+
source = smart_escape(smart_unescape(source))
|
|
567
569
|
source_to_sign = source
|
|
568
570
|
unless url_suffix.blank?
|
|
569
571
|
raise(CloudinaryException, "url_suffix should not include . or /") if url_suffix.match(%r([\./]))
|
|
@@ -767,13 +769,18 @@ class Cloudinary::Utils
|
|
|
767
769
|
"#{public_id}#{ext}"
|
|
768
770
|
end
|
|
769
771
|
|
|
770
|
-
# Based on CGI::
|
|
772
|
+
# Based on CGI::escape. In addition does not escape / :
|
|
771
773
|
def self.smart_escape(string, unsafe = /([^a-zA-Z0-9_.\-\/:]+)/)
|
|
772
774
|
string.gsub(unsafe) do |m|
|
|
773
775
|
'%' + m.unpack('H2' * m.bytesize).join('%').upcase
|
|
774
776
|
end
|
|
775
777
|
end
|
|
776
778
|
|
|
779
|
+
# Based on CGI::unescape. In addition keeps '+' character as is
|
|
780
|
+
def self.smart_unescape(string)
|
|
781
|
+
CGI.unescape(string.sub('+', '%2B'))
|
|
782
|
+
end
|
|
783
|
+
|
|
777
784
|
def self.random_public_id
|
|
778
785
|
sr = defined?(ActiveSupport::SecureRandom) ? ActiveSupport::SecureRandom : SecureRandom
|
|
779
786
|
sr.base64(20).downcase.gsub(/[^a-z0-9]/, "").sub(/^[0-9]+/, '')[0,20]
|
data/lib/cloudinary/version.rb
CHANGED
|
@@ -164,7 +164,7 @@ var slice = [].slice,
|
|
|
164
164
|
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
|
165
165
|
* @example
|
|
166
166
|
*
|
|
167
|
-
* function Foo(){};
|
|
167
|
+
* function Foo(){};
|
|
168
168
|
* isFunction(Foo);
|
|
169
169
|
* // => true
|
|
170
170
|
*
|
|
@@ -3070,7 +3070,7 @@ var slice = [].slice,
|
|
|
3070
3070
|
* @protected
|
|
3071
3071
|
* @param {string} key - attribute name
|
|
3072
3072
|
* @param {*|boolean} value - the value of the attribute. If the value is boolean `true`, return the key only.
|
|
3073
|
-
* @returns {string} the attribute
|
|
3073
|
+
* @returns {string} the attribute
|
|
3074
3074
|
*
|
|
3075
3075
|
*/
|
|
3076
3076
|
|
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.
|
|
4
|
+
version: 1.14.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: 2020-
|
|
13
|
+
date: 2020-05-06 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: aws_cf_signer
|
|
@@ -74,14 +74,14 @@ dependencies:
|
|
|
74
74
|
requirements:
|
|
75
75
|
- - ">="
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
|
-
version:
|
|
77
|
+
version: 13.0.1
|
|
78
78
|
type: :development
|
|
79
79
|
prerelease: false
|
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
|
81
81
|
requirements:
|
|
82
82
|
- - ">="
|
|
83
83
|
- !ruby/object:Gem::Version
|
|
84
|
-
version:
|
|
84
|
+
version: 13.0.1
|
|
85
85
|
- !ruby/object:Gem::Dependency
|
|
86
86
|
name: sqlite3
|
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -156,16 +156,16 @@ dependencies:
|
|
|
156
156
|
name: simplecov
|
|
157
157
|
requirement: !ruby/object:Gem::Requirement
|
|
158
158
|
requirements:
|
|
159
|
-
- - "
|
|
159
|
+
- - ">"
|
|
160
160
|
- !ruby/object:Gem::Version
|
|
161
|
-
version:
|
|
161
|
+
version: 0.18.0
|
|
162
162
|
type: :development
|
|
163
163
|
prerelease: false
|
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
|
165
165
|
requirements:
|
|
166
|
-
- - "
|
|
166
|
+
- - ">"
|
|
167
167
|
- !ruby/object:Gem::Version
|
|
168
|
-
version:
|
|
168
|
+
version: 0.18.0
|
|
169
169
|
description: Client library for easily using the Cloudinary service
|
|
170
170
|
email:
|
|
171
171
|
- nadav.soferman@cloudinary.com
|
|
@@ -175,6 +175,8 @@ executables: []
|
|
|
175
175
|
extensions: []
|
|
176
176
|
extra_rdoc_files: []
|
|
177
177
|
files:
|
|
178
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
|
179
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
|
178
180
|
- ".gitignore"
|
|
179
181
|
- ".rspec"
|
|
180
182
|
- ".travis.yml"
|