summaryrefslogtreecommitdiff
path: root/spec/uploaders/object_storage/cdn/google_cdn_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/uploaders/object_storage/cdn/google_cdn_spec.rb')
-rw-r--r--spec/uploaders/object_storage/cdn/google_cdn_spec.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/uploaders/object_storage/cdn/google_cdn_spec.rb b/spec/uploaders/object_storage/cdn/google_cdn_spec.rb
index 184c664f6dc..96413f622e8 100644
--- a/spec/uploaders/object_storage/cdn/google_cdn_spec.rb
+++ b/spec/uploaders/object_storage/cdn/google_cdn_spec.rb
@@ -99,9 +99,10 @@ RSpec.describe ObjectStorage::CDN::GoogleCDN,
let(:path) { '/path/to/file.txt' }
let(:expiration) { (Time.current + 10.minutes).utc.to_i }
let(:cdn_query_params) { "Expires=#{expiration}&KeyName=#{key_name}" }
+ let(:encoded_path) { Addressable::URI.encode_component(path, Addressable::URI::CharacterClasses::PATH) }
def verify_signature(url, unsigned_url)
- expect(url).to start_with("#{options[:url]}#{path}")
+ expect(url).to start_with("#{options[:url]}#{encoded_path}")
uri = Addressable::URI.parse(url)
query = uri.query_values
@@ -116,6 +117,16 @@ RSpec.describe ObjectStorage::CDN::GoogleCDN,
end
end
+ context 'with UTF-8 characters in path' do
+ let(:path) { "/path/to/©️job🧪" }
+ let(:url) { subject.signed_url(path) }
+ let(:unsigned_url) { "#{options[:url]}#{encoded_path}?#{cdn_query_params}" }
+
+ it 'returns a valid signed URL' do
+ verify_signature(url, unsigned_url)
+ end
+ end
+
context 'with default query parameters' do
let(:url) { subject.signed_url(path) }
let(:unsigned_url) { "#{options[:url]}#{path}?#{cdn_query_params}" }