linkhum-url 0.1.7 → 0.1.8

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/linkhum/url.rb +5 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4828723c55573337e62de25f8715302fd82faa2
4
- data.tar.gz: 48d3c36a73d00df28cf077158d05140fc27317a0
3
+ metadata.gz: cec615cf257a77a0b7ed71f4e74f1b4002f3d697
4
+ data.tar.gz: 27d62d7d172ad1d1cb52e85374354d2e72c403d8
5
5
  SHA512:
6
- metadata.gz: 005426d3dcdffcd884486064fd67c3211a9ad599c399631b575a5683617631218609a3cfcaaf22ff85667398c03357102a00f5030b343c923218fbb5d5300c5a
7
- data.tar.gz: 50a941aa4b8d1776ebac7f909a491e5ebeb2235d13ad70bb20bafe192c7938e4970994229cda243dd1bafe529e60d2d1363445ae2534682a851462dff8169ec7
6
+ metadata.gz: 0c09b139f99966d937e43b0cd27537461b8c421dc15587be5c015c53a86d6ad59c71d08862683cdf32304ad6b981a585e18f62aac5c825416ce6324636b2dab8
7
+ data.tar.gz: a5024c7a8633382e45b01443e383c3f400d64e976c56321636b617627463037c1323829fa21a307e0aa52ce5d19da0814833f540bfefdde7e9fc4873d6699882
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.1.8:
2
+
3
+ * handle invalid UTF-8 in percent-encoded paths;
4
+
1
5
  0.1.7:
2
6
 
3
7
  * percent-encode square brackets in :url_encoded part of the result, because of HTTParty;
data/lib/linkhum/url.rb CHANGED
@@ -30,6 +30,11 @@ module Linkhum
30
30
  end
31
31
  au_path.force_encoding(Encoding::ASCII_8BIT)
32
32
  url_encoded[:path] = encode_component(au_path)
33
+ decoded_path = human_readable[:path].dup
34
+ if !decoded_path.force_encoding(Encoding::UTF_8).valid_encoding?
35
+ human_readable[:path] = au.path
36
+ end
37
+
33
38
  human_readable[:query] = unencode_component(au.query, false)
34
39
  if au.query
35
40
  decoded_query = human_readable[:query].dup
@@ -37,7 +42,6 @@ module Linkhum
37
42
  human_readable[:query] = au.query
38
43
  end
39
44
  end
40
-
41
45
  if au.query
42
46
  # see above
43
47
  au_query = au.query.dup
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linkhum-url
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Makhotkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-17 00:00:00.000000000 Z
11
+ date: 2018-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  requirements: []
114
114
  rubyforge_project:
115
- rubygems_version: 2.6.10
115
+ rubygems_version: 2.6.14
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: Linkhum-URL creates both URL-encoded and readable versions of URLs