pakyow-assets 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -1
  3. data/lib/pakyow/assets/external.rb +21 -15
  4. metadata +10 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d835e94d5a1dc792fb8e3f0f943780e6ae6e9d477742b4a03c470a0afa664d5
4
- data.tar.gz: 6b9c1c1f17ad8a054d91c1e37940d6cefbc88f9d7e2a76439bd40edce7f0dd98
3
+ metadata.gz: d149e9ba386ff179a2e15792fb042aa087238628605d52f92a0c298891381f8e
4
+ data.tar.gz: d1242979e4fe6bc16ceed07f10b9421ee3699713cc53419189d99a9c604ecf69
5
5
  SHA512:
6
- metadata.gz: 39a751d90c7d04f47e2c88be8dcce709c4a809caad1c62c5e7a0df2859e7ad17f314f723e9202d087426406d6f58aa0d01d29bd17aec83eeaf56de8e0a011ee7
7
- data.tar.gz: 23252b5168d08e7cbc0c8d038e21219bd81e777b3f7d2fa5ee0826f0508ecbe3bf9073d111a35a73bc37052d6cea0d78a4fc60fa4aa30fb9f097a9ff33fa0620
6
+ metadata.gz: 2ed2ef9b92ac7418d89c5023d938e737ddee023351c4cdd000e2e02d23b27c5e231bcb166b0f715b314ac0dca2a21368dda6ef5aa0556754c11ef81ddf9d44cd
7
+ data.tar.gz: 36c0fc6775e41221c840f62a0493027259e78319ea76c03f3db1c3ed2269161b0d5528edd9b8d8f963ca448381aa49a3aee4f5ea169fc3172acc36501dcfd101
data/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
- # v1.0.3 (unreleased)
1
+ # v1.0.4
2
+
3
+ * `fix` **Escape external asset uris so they do not fail on fetch.**
4
+
5
+ *Related links:*
6
+ - [Commit e2d7e2e][e2d7e2e]
7
+
8
+ [e2d7e2e]: https://github.com/pakyow/pakyow/commit/e2d7e2ea2f36cb0a4c7073c17a692423b5cd1efe
9
+
10
+ # v1.0.3
2
11
 
3
12
  * `fix` **Make `pakyow/assets` compatible with Ruby 2.7.0.**
4
13
  - External assets used the `http` gem, which is failing on Ruby 2.7.0-preview3. We replaced it
@@ -58,12 +58,12 @@ module Pakyow
58
58
  Support::CLI::Runner.new(message: "Fetching #{file_with_version}").run do |runner|
59
59
  Async do
60
60
  downloader = Downloader.new(
61
- File.join(@config.externals.provider, package_with_version, file.to_s)
61
+ File.join(@config.externals.provider, CGI.escape(package_with_version), CGI.escape(file.to_s))
62
62
  ).perform
63
63
 
64
64
  FileUtils.mkdir_p(@config.externals.path)
65
65
 
66
- fetched_version = downloader.path.to_s.split(@package.to_s, 2)[1].split("/", 2)[0].split("@", 2)[1]
66
+ fetched_version = CGI.unescape(downloader.path.to_s).split(@package.to_s, 2)[1].split("/", 2)[0].split("@", 2)[1]
67
67
  file_basename = File.basename(file.to_s, File.extname(file.to_s))
68
68
 
69
69
  local_path = if file && file_basename != name.to_s
@@ -109,20 +109,26 @@ module Pakyow
109
109
  private def get(path)
110
110
  @path = path
111
111
  internet = Async::HTTP::Internet.new
112
- response = internet.get(build_uri(path))
113
- @status = response.status
114
-
115
- if response.status == 301 || response.status == 302
116
- get(response.headers["location"])
117
- elsif response.status >= 500
118
- raise Failed, "Unexpected response status: #{response.status}"
119
- else
120
- @body = response.body.read
121
- end
122
- rescue SocketError => error
123
- raise Failed.build(error)
112
+
113
+ Async do
114
+ begin
115
+ response = internet.get(build_uri(path))
116
+ @status = response.status
117
+
118
+ if response.status == 301 || response.status == 302
119
+ get(response.headers["location"])
120
+ elsif response.status >= 500
121
+ raise Failed, "Unexpected response status: #{response.status}"
122
+ else
123
+ @body = response.body.read
124
+ end
125
+ rescue SocketError => error
126
+ raise Failed.build(error)
127
+ ensure
128
+ response&.close
129
+ end
130
+ end.wait
124
131
  ensure
125
- response&.close
126
132
  internet&.close
127
133
  end
128
134
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pakyow-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Powell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-15 00:00:00.000000000 Z
11
+ date: 2020-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pakyow-core
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.3
19
+ version: 1.0.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.3
26
+ version: 1.0.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pakyow-presenter
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.3
33
+ version: 1.0.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.3
40
+ version: 1.0.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pakyow-routing
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.3
47
+ version: 1.0.4
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.3
54
+ version: 1.0.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pakyow-support
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.3
61
+ version: 1.0.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 1.0.3
68
+ version: 1.0.4
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: async-http
71
71
  requirement: !ruby/object:Gem::Requirement