Skip to content

[19.0][FIX] fs_attachment: don't crash on fs streams without mimetype - #712

Open
lmignon wants to merge 1 commit into
OCA:19.0from
acsone:19.0-fix-fs_attachment-stream-no-mimetype
Open

lmignon wants to merge 1 commit into
OCA:19.0from
acsone:19.0-fix-fs_attachment-stream-no-mimetype

Conversation

@lmignon

@lmignon lmignon commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

For "fs" streams, the mimetype is taken as is from the attachment and may be empty for attachments written outside the ORM. Since #584, ir.binary._get_stream_from then called guess_extension(False), and FsStream.get_response passed mimetype=False to werkzeug: both raised an AttributeError and the download returned a 500.

Fall back to default_mimetype for fs streams with no mimetype, as core does for "data" and "path" streams, and only run the extension guess for fs streams, since core already does it for the other stream types.

Fixes #684
Forward port #685

For "fs" streams, the mimetype is taken as is from the attachment and may
be empty for attachments written outside the ORM. Since OCA#584,
ir.binary._get_stream_from then called guess_extension(False), and
FsStream.get_response passed mimetype=False to werkzeug: both raised an
AttributeError and the download returned a 500.

Fall back to default_mimetype for fs streams with no mimetype, as core
does for "data" and "path" streams, and only run the extension guess for
fs streams, since core already does it for the other stream types.

Fixes OCA#684
@lmignon lmignon changed the title [FIX] fs_attachment: don't crash on fs streams without mimetype [19.0][FIX] fs_attachment: don't crash on fs streams without mimetype Dec 4, 2026
@lmignon

lmignon commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor Author

It's strange to see that the behavior is different in 16 and 17 and this fix should not be required see #711 and 710. We should investigate to be sure that we don't miss something..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[18.0][19.0] fs_attachment: 500 when downloading an fs attachment without mimetype

3 participants