Browse Source

Fixed filename with hash issue

tobychui 3 years ago
parent
commit
4cb573190e

+ 0 - 0
web/PDF Viewer/index.html


+ 1 - 1
web/PDF Viewer/viewer.js

@@ -251,7 +251,7 @@ if (inputFiles == null){
   //Leave the openURL to be nofile.pdf
   //Leave the openURL to be nofile.pdf
 }else{
 }else{
   //Open the file using media server
   //Open the file using media server
-  openURL = (ao_module_getAORootFromScriptPath() + "media/?file=" + inputFiles[0].filepath);
+  openURL = (ao_module_getAORootFromScriptPath() + "media/?file=" + encodeURIComponent(inputFiles[0].filepath));
 }
 }
 
 
 var defaultOptions = {
 var defaultOptions = {

+ 3 - 3
web/SystemAO/file_system/file_explorer.html

@@ -1908,7 +1908,7 @@
                     }
                     }
                 }
                 }
 
 
-                thumbRenderWebSocket = new WebSocket(protocol + window.location.hostname + ":" + port + "/system/file_system/handleCacheRender?folder=" + path);
+                thumbRenderWebSocket = new WebSocket(protocol + window.location.hostname + ":" + port + "/system/file_system/handleCacheRender?folder=" + encodeURIComponent(path));
 
 
                 thumbRenderWebSocket.onopen = function(e) {
                 thumbRenderWebSocket.onopen = function(e) {
 
 
@@ -4640,7 +4640,7 @@
                     //console.log("Firefox Mode: ", uploadDir, "Target Dir", targetDir)
                     //console.log("Firefox Mode: ", uploadDir, "Target Dir", targetDir)
                 }
                 }
 
 
-                let socket = new WebSocket(protocol + window.location.hostname + ":" + port + "/system/file_system/lowmemUpload?filename=" + filename + "&path=" + uploadDir);
+                let socket = new WebSocket(protocol + window.location.hostname + ":" + port + "/system/file_system/lowmemUpload?filename=" + encodeURIComponent(filename) + "&path=" + encodeURIComponent(uploadDir));
                 let currentSendingIndex = 0;
                 let currentSendingIndex = 0;
                 let chunks = Math.ceil(file.size/uploadFileChunkSize,uploadFileChunkSize);
                 let chunks = Math.ceil(file.size/uploadFileChunkSize,uploadFileChunkSize);
                 
                 
@@ -4815,7 +4815,7 @@
                     //The upload paramter supplied targetDir
                     //The upload paramter supplied targetDir
                     uploadCurrentPath = targetDir;
                     uploadCurrentPath = targetDir;
                 }
                 }
-                let url = '../../system/file_system/upload?path=' + uploadCurrentPath
+                let url = '../../system/file_system/upload?path=' + encodeURIComponent(uploadCurrentPath)
                 //console.log("Uploading To => ", uploadCurrentPath, targetDir, currentPath);
                 //console.log("Uploading To => ", uploadCurrentPath, targetDir, currentPath);
                 let formData = new FormData()
                 let formData = new FormData()
                 let xhr = new XMLHttpRequest()
                 let xhr = new XMLHttpRequest()