mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-09 17:26:47 +02:00
Handle moving files into a skipped .folder when skip_dotfiles = true (#828)
* If skip_dotfiles = true, moving files into a skipped .folder should not throw an error and should be removed from their previous location on OneDrive * Add log message to indicate why delete operation is occurring on item which was moved
This commit is contained in:
parent
4cb0ebbfde
commit
1e8395fb73
|
@ -706,7 +706,7 @@ int main(string[] args)
|
|||
} catch (CurlException e) {
|
||||
log.vlog("Offline, cannot move item!");
|
||||
} catch(Exception e) {
|
||||
log.logAndNotify("Cannot move item:, ", e.msg);
|
||||
log.logAndNotify("Cannot move item: ", e.msg);
|
||||
}
|
||||
};
|
||||
signal(SIGINT, &exitHandler);
|
||||
|
|
15
src/sync.d
15
src/sync.d
|
@ -3351,6 +3351,21 @@ final class SyncEngine
|
|||
uploadDeleteItem(toItem, to);
|
||||
}
|
||||
if (!itemdb.selectByPath(dirName(to), defaultDriveId, parentItem)) {
|
||||
// the parent item is not in the database
|
||||
|
||||
// is the destination a .folder that is being skipped?
|
||||
if (cfg.getValueBool("skip_dotfiles")) {
|
||||
if (isDotFile(dirName(to))) {
|
||||
// target location is a .folder
|
||||
log.vdebug("Target location is excluded from sync due to skip_dotfiles = true");
|
||||
// item will have been moved locally, but as this is now to a location that is not synced, needs to be removed from OneDrive
|
||||
log.log("Item has been moved to a location that is excluded from sync operations. Removing item from OneDrive");
|
||||
uploadDeleteItem(fromItem, from);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// some other error
|
||||
throw new SyncException("Can't move an item to an unsynced directory");
|
||||
}
|
||||
if (fromItem.driveId != parentItem.driveId) {
|
||||
|
|
Loading…
Reference in a new issue