active_encode 1.1.2 → 1.1.3

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
  SHA256:
3
- metadata.gz: aae1d452186e5101e0e42b4211fd25da561b068caee41d8839f019067309048a
4
- data.tar.gz: d54cc90a08b0907885281ada0ad0c8a62aae0806213b36010282e279f85803bc
3
+ metadata.gz: bec033b26b07c4ce739d3eed03b59ded7708c8482bcb6e217e1f39a3ffbe124e
4
+ data.tar.gz: 15256720816a5d6bd5bc7e2e7dc2fb4ff68da5be8e76510983195cece3649406
5
5
  SHA512:
6
- metadata.gz: c1080a31e991e8784dcbf9a8b1f7740fedf299a3eb5075d3ff9f665589fe0f73560679f592f3e97925a9424277a6e12a845187501858d520e2564f3e2a078302
7
- data.tar.gz: 77f94da2c42eeaff56e9298138b1c04a5a79a7fc7b256bd6fa65ba691cb25b3b216dd1cfbad414ad22f3180aceb934a07518a0a2fb062ce63dc8c6f37a3ab6e1
6
+ metadata.gz: b50c4b4a821ac341b0d206379298ddc973178dea565c8f268770850559cc400cf1e6afe280ee2785b0e30a37e571aaff97f4c5a11fb90e1eff00d8bbef1875f7
7
+ data.tar.gz: 62e66bf1a4f2792f11eb545c3fc09d510d42d0a5f1a392c4f73994e0bd0fc6170bcec18a6ce7c7c255b63e94822af2a3266c9a14608855250c9e735d5a236b9d
@@ -24,7 +24,9 @@ module ActiveEncode
24
24
  when /^file\:\/\/\//
25
25
  input_url.to_s.gsub(/file:\/\//, '')
26
26
  when /^s3\:\/\//
27
- input_url.to_s.gsub(/#{input_url.normalized_site}/, '')
27
+ input_url.to_s.gsub(/#{Addressable::URI.parse(input_url).normalized_site}/, '')
28
+ when /^https?:\/\//
29
+ input_url
28
30
  end
29
31
  end
30
32
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ActiveEncode
3
- VERSION = '1.1.2'
3
+ VERSION = '1.1.3'
4
4
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+ require 'addressable'
4
+
5
+ describe ActiveEncode::FilenameSanitizer do
6
+ describe '#sanitize_uri' do
7
+ it 'removes file scheme' do
8
+ uri = "file:///path/to/file"
9
+ expect(ActiveEncode.sanitize_uri(uri)).to eq "/path/to/file"
10
+ end
11
+ it 'relativizes s3 uris' do
12
+ uri = "s3://mybucket/guitar.mp4"
13
+ expect(ActiveEncode.sanitize_uri(uri)).to eq "/guitar.mp4"
14
+ end
15
+ it 'does nothing for http(s) uris' do
16
+ uri = "https://www.googleapis.com/drive/v3/files/1WkWJ12WecI9hX-PmEbuKDGLPK_mN3kYP?alt=media"
17
+ expect(ActiveEncode.sanitize_uri(uri)).to eq uri
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_encode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein, Chris Colvard, Phuong Dinh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-30 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -421,6 +421,7 @@ files:
421
421
  - spec/units/core_spec.rb
422
422
  - spec/units/engine_adapter_spec.rb
423
423
  - spec/units/file_locator_spec.rb
424
+ - spec/units/filename_sanitizer_spec.rb
424
425
  - spec/units/global_id_spec.rb
425
426
  - spec/units/input_spec.rb
426
427
  - spec/units/output_spec.rb
@@ -577,6 +578,7 @@ test_files:
577
578
  - spec/units/core_spec.rb
578
579
  - spec/units/engine_adapter_spec.rb
579
580
  - spec/units/file_locator_spec.rb
581
+ - spec/units/filename_sanitizer_spec.rb
580
582
  - spec/units/global_id_spec.rb
581
583
  - spec/units/input_spec.rb
582
584
  - spec/units/output_spec.rb