[FIX] web_pwa_oca: Guess properly mimetype

It seems since 3bd0327d6d
that the mimetype detection is not working properly for not fully
compliant SVG.

Let's resave SVG for having a compatible one + add a pointer when the
mimetype doesn't conform.
This commit is contained in:
Pedro M. Baeza
2021-11-19 21:01:08 +01:00
committed by sergio-teruel
parent 23b7e14206
commit 6b820d48d7
6 changed files with 93 additions and 14 deletions

View File

@@ -128,7 +128,10 @@ class ResConfigSettings(models.TransientModel):
if not pwa_icon_mimetype.startswith(
"image/svg"
) and not pwa_icon_mimetype.startswith("image/png"):
raise exceptions.UserError(_("You can only upload SVG or PNG files"))
raise exceptions.UserError(
_("You can only upload SVG or PNG files. Found: %s.")
% pwa_icon_mimetype
)
# Delete all previous records if we are writting new ones
if pwa_icon_ir_attachments:
pwa_icon_ir_attachments.unlink()