Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions fs_attachment/models/ir_binary.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging
from mimetypes import guess_extension

import werkzeug.http

from odoo import models
from odoo.http import request
from odoo.tools.image import image_process
from odoo.tools.mimetypes import get_extension

from ..fs_stream import FsStream

Expand Down Expand Up @@ -74,6 +76,12 @@ def _get_stream_from(
elif record and filename_field in record:
stream.download_name = record[filename_field] or stream.download_name

if (
not get_extension(stream.download_name)
and stream.mimetype != "application/octet-stream"
):
stream.download_name += guess_extension(stream.mimetype) or ""

return stream

def _get_image_stream_from(
Expand Down
Loading