]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/blobdiff - app/js/app.js
ensure we deal with encoding of paths correctly on the client
[perso/Immae/Projets/Nodejs/Surfer.git] / app / js / app.js
index 6017d25f1cec740943d3cb97ddfb69d41ec0ae18..b26a2a6c037b86833af219b24521bd1834ca5d6a 100644 (file)
@@ -105,18 +105,18 @@ function loadDirectory(filePath) {
 }
 
 function open(entry) {
-    var path = encode(sanitize(app.path + '/' + entry.filePath));
+    var path = sanitize(app.path + '/' + entry.filePath);
 
     if (entry.isDirectory) {
         window.location.hash = path;
         return;
     }
 
-    window.open(path);
+    window.open(encode(path));
 }
 
 function up() {
-    window.location.hash = encode(sanitize(app.path.split('/').slice(0, -1).filter(function (p) { return !!p; }).join('/')));
+    window.location.hash = sanitize(app.path.split('/').slice(0, -1).filter(function (p) { return !!p; }).join('/'));
 }
 
 function upload() {
@@ -143,6 +143,9 @@ function upload() {
         });
     });
 
+    // reset the form first to make the change handler retrigger even on the same file selected
+    $('#fileUploadForm')[0].reset();
+
     app.$els.upload.click();
 }