From eb89909fe0b2340f00f2f400dad636d227557761 Mon Sep 17 00:00:00 2001
From: Juan Fuentes <juanf@bs-mbpr465.d.ethz.ch>
Date: Fri, 27 Aug 2021 12:58:58 +0200
Subject: [PATCH] SSDM-11573 : Fix URL encodig for filenames

---
 .../1/as/webapps/eln-lims/html/js/util/JupyterUtil.js  | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/JupyterUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/JupyterUtil.js
index 81b9b77dee6..975a89375cc 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/JupyterUtil.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/JupyterUtil.js
@@ -19,7 +19,7 @@ var JupyterUtil = new function() {
 	this.getJupyterURL = function(path) {
 	    var url = profile.jupyterEndpoint + "hub/login?token=" + mainController.serverFacade.getSession();
 	    if(path) {
-	        url = url + "&next=" + path;
+	        url = url + "&next=" + encodeURIComponent(path);
 	    }
 	    return url;
 	}
@@ -32,7 +32,7 @@ var JupyterUtil = new function() {
 	this.openJupyterNotebookFromTemplate = function(folder, fileName, template, dataSetId, keepHistory) {
 		fileName = fileName + ".ipynb";
 		var jupyterURL = profile.jupyterIntegrationServerEndpoint + "?token=" + mainController.serverFacade.openbisServer.getSession() + "&folder=" + folder + "&filename=" + fileName;
-		var jupyterNotebookURL = JupyterUtil.getJupyterURL("/user/" + mainController.serverFacade.getUserId() + "/notebooks/" + folder + "/");
+		var jupyterNotebookURL = JupyterUtil.getJupyterURL("/user/" + mainController.serverFacade.getUserId() + "/notebooks/" + folder + "/" + fileName);
 		
 		$.ajax({
             url : jupyterURL + "&test=True",
@@ -67,7 +67,7 @@ var JupyterUtil = new function() {
                     crossDomain: true,
                     data : JSON.stringify(jupyterNotebookJson),
                     success : function(result) {
-                    	var win = window.open(jupyterNotebookURL + result.fileName, '_blank');
+                    	var win = window.open(jupyterNotebookURL, '_blank');
         				win.focus(); 
                     },
                     error : function(result) {
@@ -94,7 +94,7 @@ var JupyterUtil = new function() {
             success : function(result) {
             	var fileName = result.fileName
             	var newJupyterNotebook = _this.createJupyterNotebookContent(dataSets, ownerEntity, fileName);
-        		var jupyterNotebookURL = JupyterUtil.getJupyterURL("/user/" + mainController.serverFacade.getUserId() + "/notebooks/" + folder + "/");
+        		var jupyterNotebookURL = JupyterUtil.getJupyterURL("/user/" + mainController.serverFacade.getUserId() + "/notebooks/" + folder + "/" + fileName);
         		
         		$.ajax({
                     url : jupyterURL + "&test=False",
@@ -102,7 +102,7 @@ var JupyterUtil = new function() {
                     crossDomain: true,
                     data : JSON.stringify(newJupyterNotebook),
                     success : function(result) {
-                    	var win = window.open(jupyterNotebookURL + result.fileName, '_blank');
+                    	var win = window.open(jupyterNotebookURL, '_blank');
         				win.focus(); 
                     },
                     error : function(result) {
-- 
GitLab