diff --git a/src/sync.d b/src/sync.d index 61a8463f..e5b864d0 100644 --- a/src/sync.d +++ b/src/sync.d @@ -1342,7 +1342,12 @@ final class SyncEngine // handle changed time if (newItem.type == ItemType.file && oldItem.mtime != newItem.mtime) { - setTimes(newPath, newItem.mtime, newItem.mtime); + try { + setTimes(newPath, newItem.mtime, newItem.mtime); + } catch (FileException e) { + // display the error message + displayFileSystemErrorMessage(e.msg); + } } } } @@ -1457,7 +1462,12 @@ final class SyncEngine if ((getSize(path) == fileSize) || (OneDriveFileHash == quickXorHash) || (OneDriveFileHash == sha1Hash)) { // downloaded matches either size or hash log.vdebug("Downloaded file matches reported size and or reported file hash"); - setTimes(path, item.mtime, item.mtime); + try { + setTimes(path, item.mtime, item.mtime); + } catch (FileException e) { + // display the error message + displayFileSystemErrorMessage(e.msg); + } } else { // size error? if (getSize(path) != fileSize) { diff --git a/src/upload.d b/src/upload.d index f2f86ab9..c78fd7ea 100644 --- a/src/upload.d +++ b/src/upload.d @@ -62,7 +62,16 @@ struct UploadSession { if (exists(sessionFilePath)) { log.vlog("Trying to restore the upload session ..."); - session = readText(sessionFilePath).parseJSON(); + // We cant use JSONType.object check, as this is currently a string + // We cant use a try & catch block, as it does not catch std.json.JSONException + auto sessionFileText = readText(sessionFilePath); + if(canFind(sessionFileText,"@odata.context")) { + session = readText(sessionFilePath).parseJSON(); + } else { + log.vlog("Upload session resume data is invalid"); + remove(sessionFilePath); + return false; + } // Check the session resume file for expirationDateTime if ("expirationDateTime" in session){