From 801abb5bed144d84e8dc3346e2320caf5ad12bc2 Mon Sep 17 00:00:00 2001 From: Play_it3110 Date: Wed, 16 Feb 2022 12:59:13 +0100 Subject: [PATCH] add UTF8 support --- system/JS/nav.js | 4 +++- system/PHP/download.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 system/JS/nav.js mode change 100644 => 100755 system/PHP/download.php diff --git a/system/JS/nav.js b/system/JS/nav.js old mode 100644 new mode 100755 index c071def..65b9d24 --- a/system/JS/nav.js +++ b/system/JS/nav.js @@ -19,6 +19,7 @@ const Explorer = { this.path += dir + "/"; } } + this.path = decodeURI(this.path); let paths = await request({ data: { @@ -59,7 +60,8 @@ const Explorer = { elem.onblur = function() { elem.removeAttribute("contenteditable"); let newName = elem.innerText; - newName = newName.replace(/[^a-zA-Z0-9_\[\]\.]/g, ""); + newName = newName.replace(/[ ]/g, "_"); + newName = newName.replace(/[^a-zA-Z0-9_\[\]\.\-]/g, ""); if(oldName == newName) return; if(action == false && !confirm("Do you really want to rename \""+oldName+"\" to \""+newName+"\"?")) return; let div = elem.parentNode; diff --git a/system/PHP/download.php b/system/PHP/download.php old mode 100644 new mode 100755 index 1e4fe33..2b9a266 --- a/system/PHP/download.php +++ b/system/PHP/download.php @@ -12,6 +12,7 @@ function download($path) { } else if(is_dir($path)) { chdir("$path/../"); $bn = basename($path); + setlocale(LC_CTYPE, "en_US.UTF-8"); if(preg_match('/linux/i', $_SERVER["HTTP_USER_AGENT"])) { // tar $compressed = shell_exec("tar -czf - ".escapeshellarg($bn)); @@ -19,7 +20,7 @@ function download($path) { header("Content-Disposition: attachment; filename=\"$bn.tar.gz\""); } else { // zip - $compressed = shell_exec("zip -r - ".escapeshellarg($bn)." | cat"); + $compressed = shell_exec("zip -qr - ".escapeshellarg($bn)." | cat"); // header("Content-Type: application/octet-stream"); // header("Content-Type: application/zip"); header("Content-Disposition: attachment; filename=\"$bn.zip\"");