From 0c62fc4de0c88d943b52417b5f6381839bf160c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20G=C3=B6ttsch?= Date: Wed, 28 Jan 2026 08:50:54 +0100 Subject: [PATCH] [168] data_nature_importer: Add image mime type check --- data_nature_importer/README.rst | 1 + data_nature_importer/__manifest__.py | 2 +- data_nature_importer/models/product_template.py | 5 +++++ data_nature_importer/readme/HISTORY.rst | 3 ++- data_nature_importer/static/description/index.html | 1 + 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/data_nature_importer/README.rst b/data_nature_importer/README.rst index d498167..0f0abe0 100644 --- a/data_nature_importer/README.rst +++ b/data_nature_importer/README.rst @@ -43,6 +43,7 @@ Changelog - 16.0.1.1.0: Add Queue Job support and move to server action - 16.0.1.1.1: Use default image as product image - 16.0.1.2.0: Add Extra Product Media support +- 16.0.1.2.1: Add image mime type check Bug Tracker =========== diff --git a/data_nature_importer/__manifest__.py b/data_nature_importer/__manifest__.py index faddb10..0334324 100644 --- a/data_nature_importer/__manifest__.py +++ b/data_nature_importer/__manifest__.py @@ -4,7 +4,7 @@ "author": "BAKEUP", "website": "https://www.bakeup.org", "category": "product", - "version": "16.0.1.2.0", + "version": "16.0.1.2.1", "depends": ["product", "queue_job", "website_sale"], "data": [ "security/ir.model.access.csv", diff --git a/data_nature_importer/models/product_template.py b/data_nature_importer/models/product_template.py index 9474e61..32d1f2a 100644 --- a/data_nature_importer/models/product_template.py +++ b/data_nature_importer/models/product_template.py @@ -30,6 +30,11 @@ class ProductTemplate(models.Model): image_id = None for image in images: image_id = image.get("id") + if image.get("mime_type") not in [ + "image/jpeg", + "image/png", + ]: + continue image_data = dn_utils.get_datanature_image(self, image_id, token=None) if not image_data: continue diff --git a/data_nature_importer/readme/HISTORY.rst b/data_nature_importer/readme/HISTORY.rst index b6aba38..a39c637 100644 --- a/data_nature_importer/readme/HISTORY.rst +++ b/data_nature_importer/readme/HISTORY.rst @@ -2,4 +2,5 @@ - 16.0.1.0.1: Catch empty metadata response in _get_dn_metadata - 16.0.1.1.0: Add Queue Job support and move to server action - 16.0.1.1.1: Use default image as product image -- 16.0.1.2.0: Add Extra Product Media support \ No newline at end of file +- 16.0.1.2.0: Add Extra Product Media support +- 16.0.1.2.1: Add image mime type check \ No newline at end of file diff --git a/data_nature_importer/static/description/index.html b/data_nature_importer/static/description/index.html index b38a634..667ce35 100644 --- a/data_nature_importer/static/description/index.html +++ b/data_nature_importer/static/description/index.html @@ -386,6 +386,7 @@ ul.auto-toc {
  • 16.0.1.1.0: Add Queue Job support and move to server action
  • 16.0.1.1.1: Use default image as product image
  • 16.0.1.2.0: Add Extra Product Media support
  • +
  • 16.0.1.2.1: Add image mime type check