From 6b820d48d7cc89c990abd1923c091e1632d5c980 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Fri, 19 Nov 2021 21:01:08 +0100 Subject: [PATCH] [FIX] web_pwa_oca: Guess properly mimetype It seems since https://github.com/odoo/odoo/commit/3bd0327d6d1734736986bef543349a69af3e2414 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. --- web_pwa_oca/i18n/es.po | 10 +++- web_pwa_oca/i18n/es_AR.po | 11 ++-- web_pwa_oca/i18n/pt_BR.po | 11 ++-- web_pwa_oca/i18n/web_pwa_oca.pot | 2 +- web_pwa_oca/models/res_config_settings.py | 5 +- web_pwa_oca/static/img/icons/odoo_logo.svg | 68 +++++++++++++++++++++- 6 files changed, 93 insertions(+), 14 deletions(-) diff --git a/web_pwa_oca/i18n/es.po b/web_pwa_oca/i18n/es.po index b6612a269..63eb5388d 100644 --- a/web_pwa_oca/i18n/es.po +++ b/web_pwa_oca/i18n/es.po @@ -114,9 +114,9 @@ msgstr "Solo puede cargar archivos PNG de más de 512 x 512" #. module: web_pwa_oca #: code:addons/web_pwa_oca/models/res_config_settings.py:0 -#, fuzzy, python-format -msgid "You can only upload SVG or PNG files" -msgstr "Solo puede cargar archivos SVG o PNG" +#, python-format +msgid "You can only upload SVG or PNG files. Found: %s." +msgstr "" #. module: web_pwa_oca #: code:addons/web_pwa_oca/models/res_config_settings.py:0 @@ -137,3 +137,7 @@ msgstr "[ServiceWorker] Registrada:" #, python-format msgid "[ServiceWorker] Registration failed: " msgstr "[ServiceWorker] Error en el registro: " + +#, fuzzy +#~ msgid "You can only upload SVG or PNG files" +#~ msgstr "Solo puede cargar archivos SVG o PNG" diff --git a/web_pwa_oca/i18n/es_AR.po b/web_pwa_oca/i18n/es_AR.po index 83d59c221..18a097c9b 100644 --- a/web_pwa_oca/i18n/es_AR.po +++ b/web_pwa_oca/i18n/es_AR.po @@ -71,8 +71,8 @@ msgstr "Nombre Corto de la Aplicación Web Progresiva" #: code:addons/web_pwa_oca/static/src/js/pwa_manager.js:0 #, python-format msgid "" -"Service workers are not supported! Maybe you are not using HTTPS or you work" -" in private mode." +"Service workers are not supported! Maybe you are not using HTTPS or you work " +"in private mode." msgstr "" "¡Los trabajadores de servicios no son compatibles! Quizás no esté usando " "HTTPS o trabaje en modo privado." @@ -101,8 +101,8 @@ msgstr "Puede solo cargar archivos PNG mayores a 512x512" #. module: web_pwa_oca #: code:addons/web_pwa_oca/models/res_config_settings.py:0 #, python-format -msgid "You can only upload SVG or PNG files" -msgstr "Puede solo cargar archivos SVG o PNG" +msgid "You can only upload SVG or PNG files. Found: %s." +msgstr "" #. module: web_pwa_oca #: code:addons/web_pwa_oca/models/res_config_settings.py:0 @@ -123,3 +123,6 @@ msgstr "[ServiceWorker] Registrado:" #, python-format msgid "[ServiceWorker] Registration failed: " msgstr "[ServiceWorker] Registro fallido: " + +#~ msgid "You can only upload SVG or PNG files" +#~ msgstr "Puede solo cargar archivos SVG o PNG" diff --git a/web_pwa_oca/i18n/pt_BR.po b/web_pwa_oca/i18n/pt_BR.po index cae5a53c1..cf8b1b782 100644 --- a/web_pwa_oca/i18n/pt_BR.po +++ b/web_pwa_oca/i18n/pt_BR.po @@ -71,8 +71,8 @@ msgstr "Nome Curto do App Web Progressivo" #: code:addons/web_pwa_oca/static/src/js/pwa_manager.js:0 #, python-format msgid "" -"Service workers are not supported! Maybe you are not using HTTPS or you work" -" in private mode." +"Service workers are not supported! Maybe you are not using HTTPS or you work " +"in private mode." msgstr "" "Workers de servição não são suportados! Talvez você não esteja utilizando " "HTTPS ou esteja trabalhando em modo privado." @@ -101,8 +101,8 @@ msgstr "Você só pode carregar arquivos PNG até 512x512" #. module: web_pwa_oca #: code:addons/web_pwa_oca/models/res_config_settings.py:0 #, python-format -msgid "You can only upload SVG or PNG files" -msgstr "Você só pode carregar arquivos PNG ou SVG" +msgid "You can only upload SVG or PNG files. Found: %s." +msgstr "" #. module: web_pwa_oca #: code:addons/web_pwa_oca/models/res_config_settings.py:0 @@ -123,3 +123,6 @@ msgstr "[ServiceWorker] Registrado:" #, python-format msgid "[ServiceWorker] Registration failed: " msgstr "[ServiceWorker] Falha no registro: " + +#~ msgid "You can only upload SVG or PNG files" +#~ msgstr "Você só pode carregar arquivos PNG ou SVG" diff --git a/web_pwa_oca/i18n/web_pwa_oca.pot b/web_pwa_oca/i18n/web_pwa_oca.pot index e9be3b34a..ca23f94b3 100644 --- a/web_pwa_oca/i18n/web_pwa_oca.pot +++ b/web_pwa_oca/i18n/web_pwa_oca.pot @@ -96,7 +96,7 @@ msgstr "" #. module: web_pwa_oca #: code:addons/web_pwa_oca/models/res_config_settings.py:0 #, python-format -msgid "You can only upload SVG or PNG files" +msgid "You can only upload SVG or PNG files. Found: %s." msgstr "" #. module: web_pwa_oca diff --git a/web_pwa_oca/models/res_config_settings.py b/web_pwa_oca/models/res_config_settings.py index 5e22c42df..229c55b4c 100644 --- a/web_pwa_oca/models/res_config_settings.py +++ b/web_pwa_oca/models/res_config_settings.py @@ -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() diff --git a/web_pwa_oca/static/img/icons/odoo_logo.svg b/web_pwa_oca/static/img/icons/odoo_logo.svg index 979e1e254..8a705eaf5 100644 --- a/web_pwa_oca/static/img/icons/odoo_logo.svg +++ b/web_pwa_oca/static/img/icons/odoo_logo.svg @@ -1 +1,67 @@ - + + + + + + image/svg+xml + + + + + + + + + + + +