From b2ae7cfbefc22b685f1dfba912b90630e94a9ebc Mon Sep 17 00:00:00 2001
From: Markus Scheidgen <markus.scheidgen@gmail.com>
Date: Tue, 11 Jun 2024 18:22:16 +0200
Subject: [PATCH] Fixed an url encoding issue in the h5groove integration.

Changelog: Fixed
---
 nomad/app/h5grove_app.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/nomad/app/h5grove_app.py b/nomad/app/h5grove_app.py
index 508c503539..5818c53826 100644
--- a/nomad/app/h5grove_app.py
+++ b/nomad/app/h5grove_app.py
@@ -123,8 +123,11 @@ async def add_upload_folder_path(request: Request, call_next):
     query_string = re.sub(
         r'file=.+?(?:&|\Z)', f'file={upload_path}{file}&', query_string
     )
-    query_string = re.sub(r'path=.+?(?:&|\Z)', f'path={path}&', query_string)
+    query_string = re.sub(
+        r'path=.+?(?:&|\Z)', f'path={urllib.parse.quote(path)}&', query_string
+    )
     scope['query_string'] = query_string.encode('utf-8')
+
     response = await call_next(Request(scope))
     return response
 
-- 
GitLab