zip64writer 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/zip64/structures.rb +14 -16
- data/lib/zip64/version.rb +1 -1
- metadata +5 -5
data/lib/zip64/structures.rb
CHANGED
@@ -25,7 +25,7 @@ class Block
|
|
25
25
|
|
26
26
|
def encode(object, value)
|
27
27
|
val = value || @options[:default]
|
28
|
-
[val].pack(@type).
|
28
|
+
[val].pack(@type).zip64_force_encoding("ASCII-8BIT")
|
29
29
|
rescue
|
30
30
|
raise "#{value.inspect} (#{val.inspect}?) is not a valid type for #{self.inspect}"
|
31
31
|
end
|
@@ -112,7 +112,7 @@ class Block
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def to_string
|
115
|
-
buf = ''.
|
115
|
+
buf = ''.zip64_force_encoding("ASCII-8BIT")
|
116
116
|
fields.each do |f|
|
117
117
|
buf << pack_field(f)
|
118
118
|
end
|
@@ -158,10 +158,8 @@ class Zip64ExtraField < Block
|
|
158
158
|
end
|
159
159
|
|
160
160
|
class ::String
|
161
|
-
|
162
|
-
|
163
|
-
self
|
164
|
-
end
|
161
|
+
def zip64_force_encoding(what)
|
162
|
+
respond_to?(:force_encoding) and force_encoding(what) or self
|
165
163
|
end
|
166
164
|
end
|
167
165
|
|
@@ -198,7 +196,7 @@ class LocalFileHeader < Block
|
|
198
196
|
to_string
|
199
197
|
end
|
200
198
|
def filename=(str)
|
201
|
-
str = str.dup.
|
199
|
+
str = str.dup.zip64_force_encoding('ASCII-8BIT')
|
202
200
|
self.filename_len = str.size
|
203
201
|
@filename = str
|
204
202
|
end
|
@@ -214,12 +212,12 @@ class LocalFileHeader < Block
|
|
214
212
|
(@extra_field ||= [])
|
215
213
|
end
|
216
214
|
def extra_field_str
|
217
|
-
buf = ''.
|
215
|
+
buf = ''.zip64_force_encoding('ASCII-8BIT')
|
218
216
|
extra_field.each do |field|
|
219
217
|
if field.respond_to?(:to_string)
|
220
|
-
buf << field.to_string.
|
218
|
+
buf << field.to_string.zip64_force_encoding('ASCII-8BIT')
|
221
219
|
else
|
222
|
-
buf << field.to_s.
|
220
|
+
buf << field.to_s.zip64_force_encoding('ASCII-8BIT')
|
223
221
|
end
|
224
222
|
end
|
225
223
|
buf
|
@@ -259,17 +257,17 @@ class CDFileHeader < Block
|
|
259
257
|
super + "#{@filename}#{extra_field}#{file_comment}"
|
260
258
|
end
|
261
259
|
def file_comment=(str)
|
262
|
-
str = str.
|
260
|
+
str = str.zip64_force_encoding('ASCII-8BIT')
|
263
261
|
self.file_comment_len = str.size
|
264
262
|
@file_comment = str
|
265
263
|
end
|
266
264
|
def filename=(str)
|
267
|
-
str = str.
|
265
|
+
str = str.zip64_force_encoding('ASCII-8BIT')
|
268
266
|
self.filename_len = str.size
|
269
267
|
@filename = str
|
270
268
|
end
|
271
269
|
def extra_field=(str)
|
272
|
-
str = str.
|
270
|
+
str = str.zip64_force_encoding('ASCII-8BIT')
|
273
271
|
self.extra_field_len = str.size
|
274
272
|
@extra_field = str
|
275
273
|
end
|
@@ -346,10 +344,10 @@ class InfoZipNewUnixExtraField < Block
|
|
346
344
|
case field.name
|
347
345
|
when :uid
|
348
346
|
type = MAP[@uid_size]
|
349
|
-
[@uid].pack(type).
|
347
|
+
[@uid].pack(type).zip64_force_encoding('ASCII-8BIT')
|
350
348
|
when :gid
|
351
349
|
type = MAP[@gid_size]
|
352
|
-
[@gid].pack(type).
|
350
|
+
[@gid].pack(type).zip64_force_encoding('ASCII-8BIT')
|
353
351
|
else
|
354
352
|
super
|
355
353
|
end
|
@@ -432,7 +430,7 @@ class EOCDR < Block
|
|
432
430
|
super + "#{@file_comment}"
|
433
431
|
end
|
434
432
|
def file_comment=(str)
|
435
|
-
|
433
|
+
ctr = str.zip64_force_encoding('ASCII-8BIT')
|
436
434
|
@file_comment = str
|
437
435
|
self.file_comment_len = str.size
|
438
436
|
end
|
data/lib/zip64/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zip64writer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Geoff Youngs
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-02-24 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: |
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
65
65
|
- none
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 1.8.
|
67
|
+
rubygems_version: 1.8.15
|
68
68
|
signing_key:
|
69
69
|
specification_version: 3
|
70
70
|
summary: Zip64 Output Library
|