[FIX] web: 404 response even if placeholder

- Open any product kanban view with missing images

A 404 status code is returned for missing images, while they are
replaced by a placeholder.

This can cause issues when configuring a specific 404 page in a reverse
proxy: the proxy will serve the custom page instead of the placeholder.

opw-2192663
opw-2192340

closes odoo/odoo#45157

X-original-commit: 2719c8a0e40f318787b4d7a46626de46a8fd33f0
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-02-12 09:56:12 +00:00
parent d4808210bd
commit a02e426669
+4
View File
@@ -1464,6 +1464,10 @@ class Binary(http.Controller):
placeholder_content = Binary.placeholder(image=placeholder_filename)
else:
placeholder_content = Binary.placeholder()
# Since we set a placeholder for any missing image, the status must be 200. In case one
# wants to configure a specific 404 page (e.g. though nginx), a 404 status will cause
# troubles.
status = 200
image_base64 = base64.b64encode(placeholder_content)
if not (width or height):