From 0562c524925a2f32753f3a3364523df2c19e28c5 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Thu, 6 Dec 2018 10:50:46 +1100 Subject: [PATCH] Handle short lived files (Issue #273) (PR #274) * Handle short lived files (Issue #273) * Update README.md * Add --disable-notifications to readme --- README.md | 1 + src/main.d | 6 ++++++ src/sync.d | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 5c0d76c3..699b74c2 100644 --- a/README.md +++ b/README.md @@ -481,6 +481,7 @@ no option No sync and exit --create-directory Create a directory on OneDrive - no sync will be performed. --destination-directory Destination directory for renamed or move on OneDrive - no sync will be performed. --debug-https Debug OneDrive HTTPS communication. + --disable-notifications Do not use desktop notifications in monitor mode. -d --download-only Only download remote changes --disable-upload-validation Disable upload validation when uploading to OneDrive --enable-logging Enable client activity to a separate log file diff --git a/src/main.d b/src/main.d index f3da1d70..34891706 100644 --- a/src/main.d +++ b/src/main.d @@ -365,6 +365,12 @@ int main(string[] args) log.vlog("[M] Item deleted: ", path); try { sync.deleteByPath(path); + } catch(SyncException e) { + if (e.msg == "The item to delete is not in the local database") { + log.vlog("Item cannot be deleted because not found in database"); + } else { + log.logAndNotify(e.msg); + } } catch(Exception e) { log.logAndNotify(e.msg); } diff --git a/src/sync.d b/src/sync.d index 44258494..9066bd1b 100644 --- a/src/sync.d +++ b/src/sync.d @@ -1177,6 +1177,12 @@ final class SyncEngine maxPathLength = 430; } + // A short lived file that has disappeared will cause an error - is the path valid? + if (!exists(path)) { + log.log("Skipping item - has disappeared: ", path); + return; + } + if(path.byGrapheme.walkLength < maxPathLength){ // path is less than maxPathLength