File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 11# Copyright 2023 ACSONE SA/NV
22# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
33import logging
4+ from mimetypes import guess_extension
45
56import werkzeug .http
67
78from odoo import models
89from odoo .http import request
910from odoo .tools .image import image_process
11+ from odoo .tools .mimetypes import get_extension
1012
1113from ..fs_stream import FsStream
1214
@@ -73,6 +75,12 @@ def _get_stream_from(
7375 elif record and filename_field in record :
7476 stream .download_name = record [filename_field ] or stream .download_name
7577
78+ if (
79+ not get_extension (stream .download_name )
80+ and stream .mimetype != "application/octet-stream"
81+ ):
82+ stream .download_name += guess_extension (stream .mimetype ) or ""
83+
7684 return stream
7785
7886 def _get_image_stream_from (
You can’t perform that action at this time.
0 commit comments