3
0
Fork 0

[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.
15.0-ocabot-merge-pr-2789-by-pedrobaeza-bump-patch
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

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

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()

View File

@ -1 +1,67 @@
<svg xmlns="http://www.w3.org/2000/svg" width="919" height="495" viewBox="0 0 919 495"><g fill="none"><path fill="#8F8F8F" d="M695 346c-41.421 0-75-33.579-75-75s33.579-75 75-75 75 33.579 75 75-33.579 75-75 75zm0-31c24.3 0 44-19.7 44-44s-19.7-44-44-44-44 19.7-44 44 19.7 44 44 44zm-157 31c-41.421 0-75-33.579-75-75s33.579-75 75-75 75 33.579 75 75-33.579 75-75 75zm0-31c24.3 0 44-19.7 44-44s-19.7-44-44-44-44 19.7-44 44 19.7 44 44 44zm-82-45c0 41.935-33.592 76-75.009 76C339.575 346 306 312.005 306 270.07c0-41.936 30.5-74.07 74.991-74.07 16.442 0 31.647 3.496 44.007 12.58l.002-43.49c0-8.334 7.27-15.09 15.5-15.09 8.228 0 15.5 6.762 15.5 15.09V270zm-75 45c24.3 0 44-19.7 44-44s-19.7-44-44-44-44 19.7-44 44 19.7 44 44 44z"/><path fill="#875A7B" d="M224 346c-41.421 0-75-33.579-75-75s33.579-75 75-75 75 33.579 75 75-33.579 75-75 75zm0-31c24.3 0 44-19.7 44-44s-19.7-44-44-44-44 19.7-44 44 19.7 44 44 44z"/></g><script xmlns=""/><script xmlns="" type="text/javascript"/><script xmlns="" type="text/javascript"/></svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg:svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="919"
height="495"
viewBox="0 0 919 495"
version="1.1"
id="svg8"
sodipodi:docname="odoo_logo.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)">
<svg:metadata
id="metadata14">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</svg:metadata>
<svg:defs
id="defs12" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2488"
inkscape:window-height="1025"
id="namedview10"
showgrid="false"
inkscape:zoom="0.46245919"
inkscape:cx="463.82471"
inkscape:cy="247.5"
inkscape:window-x="72"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg8" />
<svg:g
fill="none"
id="g6">
<svg:path
fill="#8F8F8F"
d="M695 346c-41.421 0-75-33.579-75-75s33.579-75 75-75 75 33.579 75 75-33.579 75-75 75zm0-31c24.3 0 44-19.7 44-44s-19.7-44-44-44-44 19.7-44 44 19.7 44 44 44zm-157 31c-41.421 0-75-33.579-75-75s33.579-75 75-75 75 33.579 75 75-33.579 75-75 75zm0-31c24.3 0 44-19.7 44-44s-19.7-44-44-44-44 19.7-44 44 19.7 44 44 44zm-82-45c0 41.935-33.592 76-75.009 76C339.575 346 306 312.005 306 270.07c0-41.936 30.5-74.07 74.991-74.07 16.442 0 31.647 3.496 44.007 12.58l.002-43.49c0-8.334 7.27-15.09 15.5-15.09 8.228 0 15.5 6.762 15.5 15.09V270zm-75 45c24.3 0 44-19.7 44-44s-19.7-44-44-44-44 19.7-44 44 19.7 44 44 44z"
id="path2" />
<svg:path
fill="#875A7B"
d="M224 346c-41.421 0-75-33.579-75-75s33.579-75 75-75 75 33.579 75 75-33.579 75-75 75zm0-31c24.3 0 44-19.7 44-44s-19.7-44-44-44-44 19.7-44 44 19.7 44 44 44z"
id="path4" />
</svg:g>
<script />
<script
type="text/javascript" />
<script
type="text/javascript" />
</svg:svg>

Before

Width:  |  Height:  |  Size: 1013 B

After

Width:  |  Height:  |  Size: 2.4 KiB