From 73912d928849d704290ba214c7a082e71eee332d Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Tue, 26 Dec 2023 14:46:15 +0100
Subject: [PATCH] Fix image search broken by hashtag

---
 .../admin/communication/photo_imports/_selector.html.erb      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/views/admin/communication/photo_imports/_selector.html.erb b/app/views/admin/communication/photo_imports/_selector.html.erb
index b2c29a8e8..3e1514af1 100644
--- a/app/views/admin/communication/photo_imports/_selector.html.erb
+++ b/app/views/admin/communication/photo_imports/_selector.html.erb
@@ -239,7 +239,7 @@ pexels_path = admin_communication_pexels_path(website_id: nil, extranet_id: nil,
       },
       searchUnsplash() {
         var url = this.unsplash.url
-                      + '?query=' + this.query
+                      + '?query=' + encodeURIComponent(this.query)
                       + '&page=' + this.unsplash.page
                       + '&per_page=' + this.parameters.per_page
                       + '&lang=' + this.parameters.lang
@@ -247,7 +247,7 @@ pexels_path = admin_communication_pexels_path(website_id: nil, extranet_id: nil,
       },
       searchPexels() {
         var url = this.pexels.url
-                    + '?query=' + this.query
+                    + '?query=' + encodeURIComponent(this.query)
                     + '&page=' + this.pexels.page
                     + '&per_page=' + this.parameters.per_page
                     + '&lang=' + this.parameters.lang
-- 
GitLab