Skip to content

Commit

Permalink
fix: 修复带空格的路径上传异常
Browse files Browse the repository at this point in the history
  • Loading branch information
Cnotech committed Sep 29, 2024
1 parent 15079c4 commit 10b74f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/cloud189.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function uploadToRemote(fileName: string, category: string): boolean {
log(`Info:Uploading ${fileName}`);
// 先尝试移除这个文件
deleteFromRemote(fileName, category, true);
cp.execSync(`cloud189 up "${localPath}" ${remotePath}`);
cp.execSync(`cloud189 up "${localPath}" "${remotePath}"`);
} catch (err: any) {
console.log(err?.output.toString());
date = new Date();
Expand Down Expand Up @@ -86,7 +86,7 @@ function deleteFromRemote(
// 读取远程目录查看是否存在
let buf;
try {
buf = cp.execSync(`cloud189 ls ${config.REMOTE_PATH}/${category}`);
buf = cp.execSync(`cloud189 ls "${config.REMOTE_PATH}/${category}"`);
} catch (err: any) {
console.log(err?.output.toString());
log(
Expand Down
4 changes: 2 additions & 2 deletions src/rclone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function uploadToRemote(fileName: string, category: string): boolean {
try {
log(`Info:Uploading ${fileName}`);
cp.execSync(
`rclone copy "${localPath}" ${config.REMOTE_NAME}:${remotePath}`,
`rclone copy "${localPath}" "${config.REMOTE_NAME}:${remotePath}"`,
getOptions(3600000),
);
} catch (err: any) {
Expand Down Expand Up @@ -71,7 +71,7 @@ function deleteFromRemote(
let buf;
try {
buf = cp.execSync(
`rclone ls ${config.REMOTE_NAME}:${config.REMOTE_PATH}/${category}`,
`rclone ls "${config.REMOTE_NAME}:${config.REMOTE_PATH}/${category}"`,
getOptions(10000),
);
} catch (err: any) {
Expand Down

0 comments on commit 10b74f4

Please sign in to comment.