fix: cannot backup files under backup root

This commit is contained in:
Samuel N Cui
2023-10-20 21:43:10 +08:00
parent 97569fdb4f
commit ecfce735c6
2 changed files with 11 additions and 2 deletions

View File

@@ -160,18 +160,22 @@ const useBackupTargetBrowser = () => {
const sources = files
.map((file) => {
if (!file) {
return undefined;
console.log('create backup job, cannot get file')
return;
}
let path = file.id.trim();
if (path.length === 0) {
console.log('create backup job, file id is too short', file)
return;
}
while (path.endsWith("/")) {
path = path.slice(0, -1);
}
const splitIdx = path.lastIndexOf("/");
let splitIdx = path.lastIndexOf("/");
if (splitIdx < 0) {
splitIdx = -1
return;
}