treat mv of new file as upload of mv target (Issue: #357)

This commit is contained in:
Norbert Preining 2019-01-22 15:14:53 +09:00 committed by GitHub
parent 7532c9d8cc
commit 16da1b4994
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1826,12 +1826,15 @@ final class SyncEngine
} }
// https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_move // https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_move
// This function is only called in monitor mode when an move event is coming from
// inotify and we try to move the item.
void uploadMoveItem(string from, string to) void uploadMoveItem(string from, string to)
{ {
log.log("Moving ", from, " to ", to); log.log("Moving ", from, " to ", to);
Item fromItem, toItem, parentItem; Item fromItem, toItem, parentItem;
if (!itemdb.selectByPath(from, defaultDriveId, fromItem)) { if (!itemdb.selectByPath(from, defaultDriveId, fromItem)) {
throw new SyncException("Can't move an unsynced item"); uploadNewFile(to);
return;
} }
if (fromItem.parentId == null) { if (fromItem.parentId == null) {
// the item is a remote folder, need to do the operation on the parent // the item is a remote folder, need to do the operation on the parent