[BUG] Existing PDF attachments return 404 after upgrading to 0.96.0
Description
After upgrading Docmost to v0.96.0, some existing PDF attachments embedded in older notes/pages return a 404 Not Found when opened.
The issue appears to affect older attachments only. Newly uploaded PDF attachments work correctly, including PDFs whose filenames contain special characters such as €.
The error returned by the API is:
{ "message": "Not Found", "statusCode": 404 }
Example of a failing request:
/api/files/0194938e-1510-700c-b146-6f2b41e9bb30/Document_€_Example.pdf Environment Docmost: 0.96.0 Storage: local filesystem Database: PostgreSQL Redis: enabled What I have verified
I initially suspected Redis or the storage layer, but several checks seem to rule this out.
- The attachment exists in PostgreSQL
The attachment with ID:
0194938e-1510-700c-b146-6f2b41e9bb30
exists in the attachments table.
I also compared it with a newer PDF attachment that works correctly:
01a0b3d3-1030-727a-ac6d-8f156ee2fdf4
I did not find any obvious difference in the attachment records.
- The physical file exists
The failing file is present on the storage volume at:
./WORKSPACE-EXAMPLE/files/0194938e-1510-700c-b146-6f2b41e9bb30/Document_€_Example.pdf
Inside the Docmost container:
/app/data/storage/WORKSPACE-EXAMPLE/files/0194938e-1510-700c-b146-6f2b41e9bb30/Document_€_Example.pdf
The file is readable by the container.
- Node can access the file
I tested the exact file path from inside the Docmost container using Node:
fs.existsSync(path)
and it returns:
true
The file metadata can also be read successfully with fs.statSync().
- Storage path structure looks correct
The failing attachment has the same storage structure as a working recent attachment:
/files//
For example:
Failing attachment:
WORKSPACE-EXAMPLE/ files/ 0194938e-1510-700c-b146-6f2b41e9bb30/ Document_€_Example.pdf
Working attachment:
WORKSPACE-EXAMPLE/ files/ 01a0b3d3-1030-727a-ac6d-8f156ee2fdf4/ Recent_Document_€_Example.pdf 5. Special characters do not appear to be the cause
The failing filename contains a € character.
However, newer attachments with special characters in their filenames work correctly.
The filename also exists correctly on the filesystem and can be accessed by Node.
- Logs
The normal Docmost logs do not show a useful error for this request, only the HTTP 404 response.
Reproduction / behavior
The important distinction is:
Older PDF attachments: return HTTP 404 Newly uploaded PDF attachments: work correctly Both attachments exist in PostgreSQL Both physical files exist in the configured storage The application container can read both files
This started after upgrading to Docmost 0.96.0.
Expected behavior
Existing attachments created before the upgrade should remain accessible after upgrading to 0.96.0.
Actual behavior
Some existing PDF attachments return:
HTTP/1.1 404 Not Found
when accessed through:
/api/files/:attachmentId/:fileName Additional information
The fact that:
the attachment exists in the database, the physical file exists, the storage path is correct, Node can access the file, and newly uploaded attachments work,
makes me suspect that the issue may be related to how older attachment records are resolved by the /api/files/:id/:fileName endpoint in 0.96.0.
I initially suspected Redis caching, but the evidence so far does not point to Redis.
Any help identifying what changed in the attachment/file resolution between previous versions and 0.96.0 would be appreciated.
Source: docmost/docmost