Repository navigation
Conversation
Contributor
|
Hi @lmignon, |
lmignon
requested changes
Oct 20, 2026
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 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jowyto
force-pushed
the
18.0-fix-fs_attachment-stream-no-mimetype
branch
from
October 20, 2026 12:42
aa3aa94 to
a3453e7
Compare
Author
|
Thanks for the review @lmignon! I've addressed your comments:
I amended the existing commit to keep a single commit. Could you take another look? |
lmignon
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #684
For
fsstreams, the mimetype is taken as is from the attachment (FsStream.from_fs_attachment) and may be empty for attachments written outside the ORM (imports, migrations). Two things then return a 500 on/web/content/<id>:ir.binary._get_stream_fromcallsguess_extension(stream.mimetype)for every stream type, andguess_extension(False)raisesAttributeError;FsStream.get_responsepassesmimetype=Falseto werkzeug'ssend_file, which also raisesAttributeError.Core avoids this for
data/pathstreams by filling an empty mimetype withguess_mimetype(head, default=default_mimetype)before adding the extension.This PR:
default_mimetypeforfsstreams with no mimetype, without reading the file from the storage to sniff it;fsstreams, since core already does it fordata/pathand leavesurlstreams alone.Tests in
test_stream.py:test_content_url_without_mimetype: fails before the fix and passes after;test_content_url_name_without_extension: covers the [18.0][IMP] fs_attachment: enhance stream download name handling based on mimetype #584 behaviour, which had no test.fs_attachmenttests: 40 passed with the fix; without it,test_content_url_without_mimetypeerrors.This is part of the work at Capitalizarme, where we run fs_attachment / fs_attachment_s3 on Odoo 18.0 Enterprise (odoo.sh). The same code is in 19.0 and 20.0; happy to forward-port once this is reviewed.
🤖 Generated with Claude Code