From 5092c59ed34dd9db1b9b16c406a6cccebdd7ae0c Mon Sep 17 00:00:00 2001 From: fyears <1142836+fyears@users.noreply.github.com> Date: Sat, 22 Jan 2022 18:01:21 +0800 Subject: [PATCH] skip empty file for onedrive --- src/sync.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/sync.ts b/src/sync.ts index 4bea2e1..8816722 100644 --- a/src/sync.ts +++ b/src/sync.ts @@ -498,6 +498,18 @@ const dispatchOperationToActual = async ( throw Error(`unknown decision in ${JSON.stringify(state)}`); } else if (state.decision === "skip") { // do nothing + } else if ( + client.serviceType === "onedrive" && + state.size_local === 0 && + !state.key.endsWith("/") && + password === "" && + (state.decision === "upload" || state.decision === "upload_clearhist") + ) { + // TODO: it's ugly, any other way to deal with empty file for onedrive? + // do nothing, skip empty file without encryption + // if it's empty folder, or it's encrypted file/folder, it continues to be uploaded. + // this branch should be earlier than normal upload / upload_clearhist branches. + log.debug(`skip empty file ${state.key} uploading for OneDrive`); } else if (state.decision === "download_clearhist") { await client.downloadFromRemote( state.key,