This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit 74bc1dc12d39ae8831de64b2bd7186337bae1e72
Author: Sebb <s...@apache.org>
AuthorDate: Wed May 1 19:29:28 2024 +0100

    Only encode parameter values, not the delimiters
---
 webui/js/source/sidebar-calendar.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/webui/js/source/sidebar-calendar.js 
b/webui/js/source/sidebar-calendar.js
index c042aa8..491b322 100644
--- a/webui/js/source/sidebar-calendar.js
+++ b/webui/js/source/sidebar-calendar.js
@@ -181,12 +181,13 @@ function calendar_scroll(me, direction) {
 function calendar_click(year, month) {
     G_current_year = year;
     G_current_month = month;
-    let searching = false;
-    let q = "";
+    let q = ""; // components are not encoded
+    let qapi = ""; // components need to be encoded for the api call
     let calendar_current_list = G_current_list;
     let calendar_current_domain = G_current_domain;
     if (G_current_json && G_current_json.searchParams) {
         q = G_current_json.searchParams.q || "";
+        qapi = encodeURIComponent(q);
         calendar_current_list = G_current_json.searchParams.list;
         calendar_current_domain = G_current_json.searchParams.domain;
         // Weave in header parameters
@@ -194,6 +195,7 @@ function calendar_click(year, month) {
             if (key.match(/^header_/)) {
                 let value = G_current_json.searchParams[key];
                 q += `&${key}=${value}`;
+                qapi += `&${key}=${encodeURIComponent(value)}`; // only encode 
the values
             }
         }
     }
@@ -207,7 +209,7 @@ function calendar_click(year, month) {
             G_apiURL, encodeURIComponent(calendar_current_list),
             encodeURIComponent(calendar_current_domain),
             encodeURIComponent(year), encodeURIComponent(month),
-            encodeURIComponent(q)
+            qapi
         ),
         renderListView, {
         to: (q && q.length > 0) ? 'search' : 
'%s@%s'.format(calendar_current_list, calendar_current_domain),

Reply via email to