ngzip 1.0.3 → 1.0.4
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.
- data/CHANGELOG.md +4 -0
- data/lib/ngzip/builder.rb +9 -1
- data/lib/ngzip/version.rb +1 -1
- data/test/data/c/A filename with space and + in it.txt +1 -0
- data/test/lib/ngzip/builder_test.rb +9 -2
- metadata +6 -4
data/CHANGELOG.md
CHANGED
data/lib/ngzip/builder.rb
CHANGED
@@ -29,7 +29,7 @@ module Ngzip
|
|
29
29
|
sprintf('%s %d %s %s',
|
30
30
|
compute_crc32(f, settings),
|
31
31
|
File.size(f).to_i,
|
32
|
-
|
32
|
+
Builder.encode(f),
|
33
33
|
f.gsub(prefix, '')
|
34
34
|
)
|
35
35
|
end.join("\n")
|
@@ -42,6 +42,14 @@ module Ngzip
|
|
42
42
|
"X-Archive-Files: zip"
|
43
43
|
end
|
44
44
|
|
45
|
+
|
46
|
+
# Public: Encode the string
|
47
|
+
#
|
48
|
+
# Returns the encoded string using URL escape formatting
|
49
|
+
def self.encode(string)
|
50
|
+
URI.encode(string).sub('+', "%2B")
|
51
|
+
end
|
52
|
+
|
45
53
|
private
|
46
54
|
|
47
55
|
# Internal: Compute a common prefix from a list of path elements
|
data/lib/ngzip/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
@@ -15,6 +15,7 @@ describe Ngzip::Builder do
|
|
15
15
|
let(:lorem) {File.expand_path('../../../data/a/lorem.txt', __FILE__)}
|
16
16
|
let(:ipsum) {File.expand_path('../../../data/a/ipsum.txt', __FILE__)}
|
17
17
|
let(:whitespaced) {File.expand_path('../../../data/a/A filename with whitespace.txt', __FILE__)}
|
18
|
+
let(:plused) {File.expand_path('../../../data/c/A filename with space and + in it.txt', __FILE__)}
|
18
19
|
let(:cargo) {File.expand_path('../../../data/b/Cargo.png', __FILE__)}
|
19
20
|
let(:sit) {File.expand_path('../../../data/sit.txt', __FILE__)}
|
20
21
|
let(:a) {File.expand_path('../../../data/a', __FILE__)}
|
@@ -105,8 +106,14 @@ describe Ngzip::Builder do
|
|
105
106
|
options = {:base_dir => Pathname.new(lorem).parent.parent.to_s + '/'}
|
106
107
|
pathes = builder.build([lorem, ipsum], options).split("\n").map{|line| line.split.last}
|
107
108
|
expected = ["a/lorem.txt", "a/ipsum.txt"]
|
108
|
-
pathes.must_equal expected
|
109
|
-
|
109
|
+
pathes.must_equal expected
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'must correctly encode filenames with a "+"' do
|
113
|
+
options = {}
|
114
|
+
name = File.join(Pathname.new(plused).parent.to_s, 'A%20filename%20with%20space%20and%20%2B%20in%20it.txt')
|
115
|
+
expected = "8f92322f 446 #{name} A filename with space and + in it.txt"
|
116
|
+
builder.build([plused], options).must_equal expected
|
110
117
|
end
|
111
118
|
|
112
119
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ngzip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- test/data/a/lorem.txt
|
68
68
|
- test/data/b/Cargo.png
|
69
69
|
- test/data/b/dolor.txt
|
70
|
+
- test/data/c/A filename with space and + in it.txt
|
70
71
|
- test/data/sit.txt
|
71
72
|
- test/lib/ngzip/builder_test.rb
|
72
73
|
- test/lib/ngzip/version_test.rb
|
@@ -86,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
87
|
version: '0'
|
87
88
|
segments:
|
88
89
|
- 0
|
89
|
-
hash:
|
90
|
+
hash: 870021569406491909
|
90
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
92
|
none: false
|
92
93
|
requirements:
|
@@ -95,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
96
|
version: '0'
|
96
97
|
segments:
|
97
98
|
- 0
|
98
|
-
hash:
|
99
|
+
hash: 870021569406491909
|
99
100
|
requirements: []
|
100
101
|
rubyforge_project:
|
101
102
|
rubygems_version: 1.8.25
|
@@ -108,6 +109,7 @@ test_files:
|
|
108
109
|
- test/data/a/lorem.txt
|
109
110
|
- test/data/b/Cargo.png
|
110
111
|
- test/data/b/dolor.txt
|
112
|
+
- test/data/c/A filename with space and + in it.txt
|
111
113
|
- test/data/sit.txt
|
112
114
|
- test/lib/ngzip/builder_test.rb
|
113
115
|
- test/lib/ngzip/version_test.rb
|