From 85c937d598ca88b35f1028a7b00211c847a4351b Mon Sep 17 00:00:00 2001 From: Murilo Polese Date: Wed, 27 Nov 2024 11:15:13 +0100 Subject: [PATCH 1/4] Fix path resolution Making sure relative path won't contain initial separator --- ui/arduino/store.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/arduino/store.js b/ui/arduino/store.js index 5c629c5..04675f4 100644 --- a/ui/arduino/store.js +++ b/ui/arduino/store.js @@ -1509,7 +1509,7 @@ async function uploadFolder(srcPath, destPath, dataConsumer) { let allFiles = await disk.ilistAllFiles(srcPath) for (let i in allFiles) { const file = allFiles[i] - const relativePath = file.path.substring(srcPath.length) + const relativePath = file.path.substring(srcPath.length+1) if (file.type === 'folder') { await serial.createFolder( serial.getFullPath( @@ -1523,7 +1523,7 @@ async function uploadFolder(srcPath, destPath, dataConsumer) { disk.getFullPath(srcPath, relativePath, ''), serial.getFullPath(destPath, relativePath, ''), (progress) => { - dataConsumer(progress, relativePath.slice(1)) + dataConsumer(progress, relativePath) } ) } From fe9704562da8f6202f302fb50793531376c49725 Mon Sep 17 00:00:00 2001 From: ubi de feo Date: Mon, 2 Dec 2024 13:21:20 +0100 Subject: [PATCH 2/4] Fixed windows path slashes on uploadFile. Signed-off-by: ubi de feo --- preload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preload.js b/preload.js index a8cf503..1153e74 100644 --- a/preload.js +++ b/preload.js @@ -60,7 +60,7 @@ const Serial = { return board.fs_save(content || ' ', filename, dataConsumer) }, uploadFile: async (src, dest, dataConsumer) => { - return board.fs_put(src, dest, dataConsumer) + return board.fs_put(src, dest.replace(path.win32.sep, '/'), dataConsumer) }, downloadFile: async (src, dest) => { let contents = await Serial.loadFile(src) From a4677a216fa6c4d17efe4506d8dc1188f60f3adb Mon Sep 17 00:00:00 2001 From: ubi de feo Date: Mon, 2 Dec 2024 13:39:21 +0100 Subject: [PATCH 3/4] Ensured all occurrences of path.win32.sep are replaced with path.posix.sep. Signed-off-by: ubi de feo --- preload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preload.js b/preload.js index 1153e74..f9874cf 100644 --- a/preload.js +++ b/preload.js @@ -60,7 +60,7 @@ const Serial = { return board.fs_save(content || ' ', filename, dataConsumer) }, uploadFile: async (src, dest, dataConsumer) => { - return board.fs_put(src, dest.replace(path.win32.sep, '/'), dataConsumer) + return board.fs_put(src, dest.replaceAll(path.win32.sep, path.posix.sep), dataConsumer) }, downloadFile: async (src, dest) => { let contents = await Serial.loadFile(src) From 3f749ed7ace5a1edf771272e599321a3a1b91e2a Mon Sep 17 00:00:00 2001 From: Murilo Polese Date: Wed, 4 Dec 2024 08:08:44 +0100 Subject: [PATCH 4/4] Removing obsolete code --- ui/arduino/store.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/arduino/store.js b/ui/arduino/store.js index 04675f4..a5718ef 100644 --- a/ui/arduino/store.js +++ b/ui/arduino/store.js @@ -1509,7 +1509,7 @@ async function uploadFolder(srcPath, destPath, dataConsumer) { let allFiles = await disk.ilistAllFiles(srcPath) for (let i in allFiles) { const file = allFiles[i] - const relativePath = file.path.substring(srcPath.length+1) + const relativePath = file.path.substring(srcPath.length) if (file.type === 'folder') { await serial.createFolder( serial.getFullPath(