Commit 908ff65d authored by Stan Hu's avatar Stan Hu

Enable Zip64 support

The original ZIP format only supports 4 GB archives and up to 65535
files (https://www.artpol-software.com/ZipArchive/KB/0610051629.aspx).
RubyZip disables the Zip64 extensions by default, unlike the standard
`zip` command-line tool.

Archives, such as GitLab Pages deployments, may have more than 65535
files. RubyZip will truncate the central directory header to indicate
only 65535 files, but some tools may treat these headers as invalid.

Relates to https://gitlab.com/gitlab-org/gitlab-pages/-/issues/689

Changelog: fixed
parent e7b2e1e1
# frozen_string_literal: true
#
# Zip64 is needed to support archives with more than 65535 entries.
Zip.write_zip64_support = true
......@@ -27,6 +27,10 @@ RSpec.describe Pages::ZipDirectoryService do
let(:archive) { result[:archive_path] }
let(:entries_count) { result[:entries_count] }
it 'returns true if ZIP64 is enabled' do
expect(::Zip.write_zip64_support).to be true
end
shared_examples 'handles invalid public directory' do
it 'returns success' do
expect(status).to eq(:success)
......@@ -35,7 +39,7 @@ RSpec.describe Pages::ZipDirectoryService do
end
end
context "when work direcotry doesn't exist" do
context "when work directory doesn't exist" do
let(:service_directory) { "/tmp/not/existing/dir" }
include_examples 'handles invalid public directory'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment