From 726e86705838a8842f5da9ebe3572aedfc9d7254 Mon Sep 17 00:00:00 2001
From: Alex Krantz <alex@krantz.dev>
Date: Mon, 5 Oct 2020 11:57:52 -0700
Subject: [PATCH] URL encode search in web UI

Fixes #986
---
 meilisearch-http/public/interface.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meilisearch-http/public/interface.html b/meilisearch-http/public/interface.html
index 1b45434b6..894a7e018 100644
--- a/meilisearch-http/public/interface.html
+++ b/meilisearch-http/public/interface.html
@@ -203,7 +203,7 @@
         if (e.selectedIndex == -1) { return }
         var index = e.options[e.selectedIndex].value;
 
-        let theUrl = `${baseUrl}/indexes/${index}/search?q=${search.value}&attributesToHighlight=*`;
+        let theUrl = `${baseUrl}/indexes/${index}/search?q=${encodeURIComponent(search.value)}&attributesToHighlight=*`;
 
         if (lastRequest) { lastRequest.abort() }
         lastRequest = new XMLHttpRequest();