-
-
Notifications
You must be signed in to change notification settings - Fork 179
Closed
Labels
Description
Describe the bug
When upgrading from v0.8.0 to v0.9.0 and found there is a new requirement that the filename must end with .docx
This doesn't play nice when the file is an Active Storage Attachment path.
Relevant commit: 3a3c850
To Reproduce
Create a model with has_one_attached :file, with storage set to local / disk.
Upload a file.
Saved in myapp/storage/xx/yy/xxyyzz....
example
record = MyModel.find(1)
puts ActiveStorage::Blob.service.path_for(record.file.key)
=> "/Users/mike/src/myapp/storage/12/34/1234abcd5678efgh9012abcd3456"
doc = Docx::Document.open(ActiveStorage::Blob.service.path_for(record.file.key))
=> Input/output error - Invalid file format (Errno::EIO)
# Duplicate the file, add .docx extension
doc = Docx::Document.open("/Users/mike/src/myapp/storage/12/34/1234abcd5678efgh9012abcd3456.docx")
# Works fine nowSample docx file
It's not an issue with the file contents. If I rename it to .docx, it works fine.
Expected behavior
Restore previous behaviour, where Docx::Document.open() does not check the file extension, or add the filename to options {}.
Environment
- Ruby version: 3.4.3
docxgem version: 0.9.0- OS: macOS 14.6.1
satoryu