trenni 3.1.1 → 3.1.2

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
  SHA1:
3
- metadata.gz: '081ca65498a2ec0527b25ce54a105bc8e19341a0'
4
- data.tar.gz: 224372fa6f3c9715858d8b1c700a050c33cf226c
3
+ metadata.gz: f537bf7c125e2f4e23c5e6ab5126d15370ee4e9a
4
+ data.tar.gz: c73fe7e8da34eaab7ab8be0ceec116181d06e462
5
5
  SHA512:
6
- metadata.gz: 3235d940fbf6eff830ab88623dc46fae3f92c6a31b20f2f37f28cac9f9f304cfdc7eb3a1d8eb0692bc5578aac09ffeb72763b3d594e51b08c4d8cb51b2aca300
7
- data.tar.gz: 9d47d3e2feb3e03b42a9abf43430113c0aef7e1e4d25bc23aaafd2c2119d620810cc1bb10a50cc92f545a605abcfce918544f91d48d05a6a3641b675e4d8a8f2
6
+ metadata.gz: d6355020eedd0017f3c8f5c578df1eb38ae59503e054556f6799a34f4ad51b794b531e552b123cf9a03e6e244db7d13dea52028ce4d3bad1d950cfe92678effb
7
+ data.tar.gz: f51f05a10d786b7250939e372efc31c878b6e18f507b707f92b2b11d42da5913ec62adae781a847650083f7c37da5493a8bbc3bce18da3f6879e2c74bc382447
@@ -64,13 +64,13 @@ module Trenni
64
64
  private
65
65
 
66
66
  # According to https://tools.ietf.org/html/rfc3986#section-3.3, we escape non-pchar.
67
- NON_PCHAR = /([^ a-zA-Z0-9\-\.~!$&'()*+,;=:@\/]+)/.freeze
67
+ NON_PCHAR = /([^a-zA-Z0-9_\-\.~!$&'()*+,;=:@\/]+)/.freeze
68
68
 
69
69
  def escape_path(path)
70
70
  encoding = path.encoding
71
71
  path.b.gsub(NON_PCHAR) do |m|
72
72
  '%' + m.unpack('H2' * m.bytesize).join('%').upcase
73
- end.tr(' ', '+').force_encoding(encoding)
73
+ end.force_encoding(encoding)
74
74
  end
75
75
 
76
76
  # Escapes a generic string, using percent encoding.
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Trenni
22
- VERSION = "3.1.1"
22
+ VERSION = "3.1.2"
23
23
  end
@@ -25,7 +25,13 @@ require 'trenni/uri'
25
25
  RSpec.describe Trenni::URI do
26
26
  describe Trenni::URI('path with spaces/image.jpg') do
27
27
  it "encodes whitespace" do
28
- expect(subject.to_s).to be == "path+with+spaces/image.jpg"
28
+ expect(subject.to_s).to be == "path%20with%20spaces/image.jpg"
29
+ end
30
+ end
31
+
32
+ describe Trenni::URI('path_with_underscores/image.jpg') do
33
+ it "doesn't touch underscores" do
34
+ expect(subject.to_s).to be == "path_with_underscores/image.jpg"
29
35
  end
30
36
  end
31
37
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trenni
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams