From 8caf1e023b69b3d2f83ac8e0eeb74f259c0f4a3d Mon Sep 17 00:00:00 2001 From: Mahamadasif Ansari Date: Mon, 10 Apr 2023 06:59:14 +0000 Subject: [PATCH] [FIX] web_unsplash: accept premium image URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "ERROR: Unknown Unsplash URL!" is generated when we try to add premium Unsplash images. This is because when we add the unsplash image, it accepts the image whose URL starts with "https://images.unsplash.com/" but the premium image URL starts with "https://plus.unsplash.com/". This commit solves the above issue by checking that the premium splash image link starts with the correct format. sentry-4075507166 closes odoo/odoo#118662 X-original-commit: 00894718cc7332131a7096c1e6dbe124d5d6d233 Signed-off-by: Romain Derie (rde) --- addons/web_unsplash/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_unsplash/controllers/main.py b/addons/web_unsplash/controllers/main.py index 5db969158c7..c072352711b 100644 --- a/addons/web_unsplash/controllers/main.py +++ b/addons/web_unsplash/controllers/main.py @@ -81,7 +81,7 @@ class Web_Unsplash(http.Controller): for key, value in unsplashurls.items(): url = value.get('url') try: - if not url.startswith('https://images.unsplash.com/') and not request.env.registry.in_test_mode(): + if not url.startswith(('https://images.unsplash.com/', 'https://plus.unsplash.com/')) and not request.env.registry.in_test_mode(): logger.exception("ERROR: Unknown Unsplash URL!: " + url) raise Exception(_("ERROR: Unknown Unsplash URL!"))