We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a7c377d + 62bcb13 commit e18645dCopy full SHA for e18645d
1 file changed
fs_attachment/models/ir_binary.py
@@ -1,12 +1,14 @@
1
# Copyright 2023 ACSONE SA/NV
2
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
import logging
4
+from mimetypes import guess_extension
5
6
import werkzeug.http
7
8
from odoo import models
9
from odoo.http import request
10
from odoo.tools.image import image_process
11
+from odoo.tools.mimetypes import get_extension
12
13
from ..fs_stream import FsStream
14
@@ -73,6 +75,12 @@ def _get_stream_from(
73
75
elif record and filename_field in record:
74
76
stream.download_name = record[filename_field] or stream.download_name
77
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
+
84
return stream
85
86
def _get_image_stream_from(
0 commit comments