From 49e2fdce78032e958a98a89bc47994af1f44721c Mon Sep 17 00:00:00 2001 From: tueddy Date: Wed, 1 Nov 2023 15:08:03 +0100 Subject: [PATCH] Fix folder upload with special chars --- changelog.md | 2 +- html/management.html | 3 ++- src/Web.cpp | 6 ++++-- src/revision.h | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index ec89d996..d20f3f3c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,7 @@ ## DEV-branch * 31.10.2023: Code Formatting via clang-format #264, thank's to @laszloh & @fschrempf !! - +* 01.11.2023: Fix folder upload with special chars & playtime formatting ## Version 2 (29.10.2023) diff --git a/html/management.html b/html/management.html index efaad3f7..e575186f 100644 --- a/html/management.html +++ b/html/management.html @@ -1075,6 +1075,7 @@ selectedNode = ref.get_node(sel); if(selectedNode.data.directory){ path = selectedNode.data.path + console.log("Directory: " + path); } else { /* remap sel to parent folder */ sel = ref.get_node(ref.get_parent(sel)); @@ -1085,7 +1086,7 @@ const startTime = new Date().getTime(); let bytesTotal = 0; $.ajax({ - url: '/explorer?path=' + path, + url: '/explorer?path=' + encodeURIComponent(path), type: 'POST', data: data, contentType: false, diff --git a/src/Web.cpp b/src/Web.cpp index 694a3b94..f2c01d5a 100644 --- a/src/Web.cpp +++ b/src/Web.cpp @@ -1046,8 +1046,10 @@ void explorerCreateParentDirectories(const char *filePath) { if (rest - filePath != 0) { memcpy(tmpPath, filePath, rest - filePath); tmpPath[rest - filePath] = '\0'; - Log_Printf(LOGLEVEL_DEBUG, "creating dir \"%s\"\n", tmpPath); - gFSystem.mkdir(tmpPath); + if (!gFSystem.exists(tmpPath)) { + Log_Printf(LOGLEVEL_DEBUG, "creating dir \"%s\"\n", tmpPath); + gFSystem.mkdir(tmpPath); + } } rest = strchr(rest + 1, '/'); } diff --git a/src/revision.h b/src/revision.h index 7c170038..299eda8f 100644 --- a/src/revision.h +++ b/src/revision.h @@ -1,4 +1,4 @@ #pragma once #include "gitrevision.h" -constexpr const char softwareRevision[] = "Software-revision: 20231031-1"; +constexpr const char softwareRevision[] = "Software-revision: 20231101-1";