Skip to content

Conversation

@abartov
Copy link
Contributor

@abartov abartov commented Dec 6, 2025

The issue with file saving was that Rubyzip 3.x now saves ZIP64 by default. This is unexpected and unsupported by many tools, and best not to enable by default in docx.

I'd appreciate it if the maintainers merge this and release a new gem.

Copilot AI review requested due to automatic review settings December 6, 2025 02:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #168 by disabling ZIP64 support in rubyzip to fix compatibility issues with file saving. Rubyzip 3.x changed its default behavior to enable ZIP64 by default, which causes problems with tools like pandoc that don't support ZIP64 for small files. The fix adds a global configuration setting to disable ZIP64 support.

  • Adds global configuration Zip.write_zip64_support = false to disable ZIP64
  • Includes explanatory comments about rubyzip 3.x default behavior change
  • Aims to restore compatibility with readers that don't support ZIP64

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 8 to 11
# Disable ZIP64 support to maintain compatibility with version 0.9.1 and
# ensure compatibility with all readers. Rubyzip 3.x enables ZIP64 by default,
# but many readers (including pandoc) don't support it for small files.
Zip.write_zip64_support = false
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting global Zip configuration in a library gem is problematic. This modifies global state for all code using rubyzip in the consuming application, potentially breaking other functionality that may need ZIP64 support.

Consider investigating per-operation ZIP64 configuration instead of global configuration. If rubyzip 3.x doesn't support per-operation configuration, consider:

  1. Documenting this global configuration change prominently in README and CHANGELOG
  2. Providing a configuration option that allows users to opt-in/out of this behavior
  3. Only setting this configuration in the save and stream methods and restoring it afterwards

This approach would minimize side effects on other code while achieving the same compatibility goal.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant