Skip to content

Sablon 0.4.3 generates .docx files that Google Drive cannot process #207

@ebabian

Description

@ebabian

Description
Word docx files generated by Sablon 0.4.3 don't preview or open in Google Docs, while 0.4.2 works fine.

After upgrading from Sablon 0.4.2 to 0.4.3 (along with rubyzip from 2.4.1 to 3.2.2), all generated .docx files fail to preview or open in Google Docs when uploaded via the Google Drive API. The files open correctly in Microsoft Word, indicating they are valid .docx files, but Google Drive's processing fails.

Environment
Ruby: 3.3.6
Sablon 0.4.3 with rubyzip 3.2.2 (broken)
Sablon 0.4.2 with rubyzip 2.4.1 (working)
Microsoft Word: Version 16.103.1
macOS

Steps to Reproduce:

  1. Generate a .docx file using Sablon 0.4.3:
template = Sablon.template(File.expand_path("path/to/template.docx"))
tempfile = Tempfile.new(["output", ".docx"], Rails.root.join("tmp"))
template.render_to_file(tempfile, context)
  1. Upload the generated file to Google Drive via API:
google_client.drive_service.create_file(
  Google::Apis::DriveV3::File.new(name: "Test Document", parents: [folder_id]),
  upload_source: tempfile.path,
  content_type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
)
  1. Attempt to preview or open the file in Google Docs

Expected Behavior: Files should preview and open in Google Docs, as they did with Sablon 0.4.2

Actual Behavior:

  • Files show "Couldn't preview file" error in Google Drive
  • "Open with Google Docs" button fails to open the document
  • Google Drive metadata shows hasThumbnail: false
  • Files download and open correctly in Microsoft Word

Timeline:

  • Before November 24, 2025: All documents working (Sablon 0.4.2)
  • November 24, 2025: Upgraded to Sablon 0.4.3 via dependency update
  • Late November 2025: Users reported documents no longer opening in Google Docs
  • December 16, 2025: Identified root cause through systematic testing
  • December 17, 2025: Confirmed downgrade to 0.4.2 fixes the issue

Workaround: Downgrade to Sablon 0.4.2 and rubyzip 2.4.1

gem 'sablon', '0.4.2'
gem 'rubyzip', '2.4.1'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions