docxify 0.1.8 → 0.1.9
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 +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/docxify/container.rb +22 -28
- data/lib/docxify/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4756efeceb4cb1e99069cfe5f5a9a4c85bcb68b34338ef069f8abb156cd31c03
|
|
4
|
+
data.tar.gz: 0b0e85411642bd9fe5389718d28ba47c2d4916c705dd0417b183cf95ad6d8d0f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69ca0622fba668674c8eb5d5de5f731dd165d9ad6f46b68ee1657990c9e991bcce426a7d5a3b585ec81c0583b24eeb9028571b9741dc24ba6a6e7a916717fd41
|
|
7
|
+
data.tar.gz: 6ddbdb78177426c2e34b9381b9cbbb361eecbf9654333753069c9e394385afd69eb4dd5d2de86762f8c1478ea14cc40a93b1d0d47f75952ce18297b5d5e11870
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 0.1.9
|
|
4
|
+
|
|
5
|
+
Security:
|
|
6
|
+
|
|
7
|
+
- Require rubyzip 3.6+ (`~> 3.6`), fixing CVE-2026-85396 (path traversal in `Zip::Entry#extract` before rubyzip 3.4.0)
|
|
8
|
+
|
|
9
|
+
Bugfix:
|
|
10
|
+
|
|
11
|
+
- Entry sizes are now declared up front when writing the docx package, so rubyzip 3 no longer adds ZIP64 headers (version needed to extract 4.5) that OPC readers such as Word and Google Docs reject
|
|
12
|
+
|
|
3
13
|
## 0.1.8
|
|
4
14
|
|
|
5
15
|
Bugfix:
|
data/lib/docxify/container.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "tempfile"
|
|
1
2
|
require "zip"
|
|
2
3
|
|
|
3
4
|
module DocXify
|
|
@@ -12,37 +13,19 @@ module DocXify
|
|
|
12
13
|
temp_file = Tempfile.new("docxify.zip")
|
|
13
14
|
|
|
14
15
|
Zip::OutputStream.open(temp_file) do |zip|
|
|
15
|
-
zip
|
|
16
|
-
zip.
|
|
17
|
-
|
|
18
|
-
zip
|
|
19
|
-
zip.
|
|
20
|
-
|
|
21
|
-
zip
|
|
22
|
-
zip.
|
|
23
|
-
|
|
24
|
-
zip.put_next_entry "word/fontTable.xml"
|
|
25
|
-
zip.write DocXify::Template.font_table
|
|
26
|
-
|
|
27
|
-
zip.put_next_entry "word/settings.xml"
|
|
28
|
-
zip.write DocXify::Template.settings
|
|
29
|
-
|
|
30
|
-
zip.put_next_entry "word/styles.xml"
|
|
31
|
-
zip.write DocXify::Template.styles
|
|
32
|
-
|
|
33
|
-
zip.put_next_entry "word/webSettings.xml"
|
|
34
|
-
zip.write DocXify::Template.web_settings
|
|
35
|
-
|
|
36
|
-
zip.put_next_entry "word/document.xml"
|
|
37
|
-
zip.write document.build_xml(self)
|
|
38
|
-
|
|
39
|
-
zip.put_next_entry "word/_rels/document.xml.rels"
|
|
40
|
-
zip.write document_xml_rels
|
|
16
|
+
write_entry zip, "_rels/.rels", DocXify::Template.top_level_rels
|
|
17
|
+
write_entry zip, "[Content_Types].xml", DocXify::Template.content_types
|
|
18
|
+
write_entry zip, "word/theme/theme1.xml", DocXify::Template.theme
|
|
19
|
+
write_entry zip, "word/fontTable.xml", DocXify::Template.font_table
|
|
20
|
+
write_entry zip, "word/settings.xml", DocXify::Template.settings
|
|
21
|
+
write_entry zip, "word/styles.xml", DocXify::Template.styles
|
|
22
|
+
write_entry zip, "word/webSettings.xml", DocXify::Template.web_settings
|
|
23
|
+
write_entry zip, "word/document.xml", document.build_xml(self)
|
|
24
|
+
write_entry zip, "word/_rels/document.xml.rels", document_xml_rels
|
|
41
25
|
|
|
42
26
|
@document.relationships.each do |relation|
|
|
43
27
|
if relation.is_a?(DocXify::Element::File)
|
|
44
|
-
zip
|
|
45
|
-
zip.write relation.data
|
|
28
|
+
write_entry zip, "word/media/#{relation.filename}", relation.data
|
|
46
29
|
end
|
|
47
30
|
end
|
|
48
31
|
end
|
|
@@ -73,5 +56,16 @@ module DocXify
|
|
|
73
56
|
xml << "</Relationships>"
|
|
74
57
|
xml
|
|
75
58
|
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
# Word and other OPC readers reject Zip64 headers. Since rubyzip 3 defaults
|
|
63
|
+
# to Zip64 for any entry whose size is unknown while its local header is
|
|
64
|
+
# streamed out, declare the size up front (all entry data is already in
|
|
65
|
+
# memory) so entries stay in the classic zip format.
|
|
66
|
+
def write_entry(zip, name, data)
|
|
67
|
+
zip.put_next_entry Zip::Entry.new(nil, name, size: data.bytesize)
|
|
68
|
+
zip.write data
|
|
69
|
+
end
|
|
76
70
|
end
|
|
77
71
|
end
|
data/lib/docxify/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: docxify
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Jeffries
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '3.6'
|
|
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: '
|
|
40
|
+
version: '3.6'
|
|
41
41
|
description: Using a relatively simple DSL, you can generate Word DocX documents from
|
|
42
42
|
Ruby.
|
|
43
43
|
email:
|
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
89
|
version: '0'
|
|
90
90
|
requirements: []
|
|
91
|
-
rubygems_version:
|
|
91
|
+
rubygems_version: 3.6.9
|
|
92
92
|
specification_version: 4
|
|
93
93
|
summary: DocXify is a gem to help you generate Word documents from Ruby.
|
|
94
94
|
test_files: []
|