liquid_xlsx 0.2.0 → 0.2.1
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 +15 -1
- data/lib/liquid_xlsx/package.rb +23 -1
- data/lib/liquid_xlsx/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2962349e5fe1197bffc9c0d28d21be73e83b97f71cf3e8ce86579c07246e5072
|
|
4
|
+
data.tar.gz: 67d36e10dfaf54790ffd949e175ba80b24940d331eb9e9b826661158b32c08ee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5f9379732f56d318bb9dba0a0fbf5a9c82e2ec782a97109043eaf6e5272aeb4a2a5eb3b7fa592dbab1d059543ba5dc3dbf3f9fdbc1637bf7c9df42ecacec88ce
|
|
7
|
+
data.tar.gz: '080cdb56014357ece810afd62e5e42271f7eb403cdcd62cb63697f894b4814b67b6c2959f11dd911dc98099b5be18e715b0cdc1c27b16cbe95c3b92e6862450f'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.2.
|
|
3
|
+
## 0.2.1 (2026-08-09)
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Rendered workbooks are no longer marked ZIP64. Members were streamed without
|
|
8
|
+
a declared size, and rubyzip 3 — where ZIP64 is on by default — then flagged
|
|
9
|
+
every member as ZIP64: version 4.5 in the local header and `0xFFFFFFFF`
|
|
10
|
+
sizes. Such an archive still satisfies rubyzip and `unzip`, but Excel reports
|
|
11
|
+
a corrupt file and LibreOffice 7.4 fails with "source file could not be
|
|
12
|
+
loaded", which also broke conversion to PDF. Newer LibreOffice reads ZIP64,
|
|
13
|
+
so the breakage only surfaced on hosts with an older build. The member size
|
|
14
|
+
is known at write time and is now declared up front, which keeps ordinary
|
|
15
|
+
local headers. rubyzip 2.x was never affected: ZIP64 is off by default there.
|
|
16
|
+
|
|
17
|
+
## 0.2.0 (2026-08-04)
|
|
4
18
|
|
|
5
19
|
### Fixed
|
|
6
20
|
|
data/lib/liquid_xlsx/package.rb
CHANGED
|
@@ -23,6 +23,17 @@ module LiquidXlsx
|
|
|
23
23
|
name == :create && %i[key keyreq].include?(type)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
# rubyzip 3 turned ZIP64 on by default. Streaming a member gives it no size
|
|
27
|
+
# up front, so it marks EVERY member as ZIP64 — version 4.5 in the local
|
|
28
|
+
# header and 0xFFFFFFFF sizes. Such an .xlsx is rejected by Excel and by
|
|
29
|
+
# LibreOffice builds without ZIP64 support (7.4 fails, 26.2 reads it).
|
|
30
|
+
# Here the member content is fully known, so the size can be declared up
|
|
31
|
+
# front and Entry#prep_local_zip64_extra leaves an ordinary header alone.
|
|
32
|
+
# rubyzip 2.x has no `size:` keyword, but there ZIP64 is off by default.
|
|
33
|
+
ZIP_SIZE_KEYWORD = Zip::File.instance_method(:get_output_stream).parameters.any? do |type, name|
|
|
34
|
+
name == :size && %i[key keyreq].include?(type)
|
|
35
|
+
end
|
|
36
|
+
|
|
26
37
|
# Guard rails against zip bombs / resource exhaustion when unpacking.
|
|
27
38
|
MAX_ENTRIES = 10_000
|
|
28
39
|
MAX_ENTRY_UNCOMPRESSED = 512 * 1024 * 1024 # 512 MB per entry
|
|
@@ -107,7 +118,7 @@ module LiquidXlsx
|
|
|
107
118
|
@files.each do |name, content|
|
|
108
119
|
next if content.nil? # directories
|
|
109
120
|
|
|
110
|
-
zip
|
|
121
|
+
write_entry(zip, name, content)
|
|
111
122
|
end
|
|
112
123
|
end
|
|
113
124
|
end
|
|
@@ -443,6 +454,17 @@ module LiquidXlsx
|
|
|
443
454
|
|
|
444
455
|
private
|
|
445
456
|
|
|
457
|
+
# The size is declared in bytes: String#size counts characters, so on UTF-8
|
|
458
|
+
# content it would disagree with what actually gets written.
|
|
459
|
+
# See ZIP_SIZE_KEYWORD — rubyzip 2.x has no such keyword and needs none.
|
|
460
|
+
def write_entry(zip, name, content)
|
|
461
|
+
if ZIP_SIZE_KEYWORD
|
|
462
|
+
zip.get_output_stream(name, size: content.bytesize) { |f| f.write(content) }
|
|
463
|
+
else
|
|
464
|
+
zip.get_output_stream(name) { |f| f.write(content) }
|
|
465
|
+
end
|
|
466
|
+
end
|
|
467
|
+
|
|
446
468
|
# Open a brand-new archive for writing across rubyzip 2.x and 3.x.
|
|
447
469
|
# See ZIP_CREATE_KEYWORD for why the call has to be spelled two ways.
|
|
448
470
|
def open_new_zip(output_path, &)
|
data/lib/liquid_xlsx/version.rb
CHANGED