From d311ebddded57507a10e020cdd5b34df1c81b6d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Hern=C3=A1ndez?= Date: Tue, 20 Oct 2020 17:04:30 +0200 Subject: [PATCH 1/3] Update version number --- include/mega/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mega/version.h b/include/mega/version.h index 2f228b69e3..438a24da98 100644 --- a/include/mega/version.h +++ b/include/mega/version.h @@ -5,5 +5,5 @@ #define MEGA_MINOR_VERSION 7 #endif #ifndef MEGA_MICRO_VERSION -#define MEGA_MICRO_VERSION 4 +#define MEGA_MICRO_VERSION 6 #endif From 3bc3ddd54b746ef7d4c9ae5418d0a1a634cc4ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Hern=C3=A1ndez?= Date: Thu, 22 Oct 2020 12:01:40 +0200 Subject: [PATCH 2/3] Fix target for movements When node is moved from cloud to inshare, and the file already exists at the target inshare's folder, the `putnodes_result()` is called directly from MegaApi, but the target is wrong. This commit considers the use case. --- src/megaapi_impl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/megaapi_impl.cpp b/src/megaapi_impl.cpp index 1baafeedac..f341eb9ed0 100644 --- a/src/megaapi_impl.cpp +++ b/src/megaapi_impl.cpp @@ -19366,7 +19366,8 @@ void MegaApiImpl::sendPendingRequests() // continue to complete the copy-delete client->restag = request->getTag(); vector emptyVec; - putnodes_result(API_OK, NODE_HANDLE, emptyVec); + targettype_t target = client->isForeignNode(newParent->nodehandle) ? USER_HANDLE : NODE_HANDLE; + putnodes_result(API_OK, target, emptyVec); break; } From 53c41df4a6d04aafe712690f570a87bb101c8c9a Mon Sep 17 00:00:00 2001 From: matt weir Date: Fri, 23 Oct 2020 16:33:06 +1300 Subject: [PATCH 3/3] Fix Move's call to putndoes_result by avoiding it `putnodes_result()` should really only be called back from an actual putnodes. In this instance, it was trying to rejoin the sequence of commands for a move, when the move turns out to be a copy, and needs to remove the old node. But, we can have much smaller and clearer code by calling `unlink()` directly and also avoid ambiguities with `putnodes_result()`, and be disentangled from it. All `putnodes_result()` does in this case, is skip through all the tests, and ultimately execute these same two lines. ^ Kudos to Matt, who proposed this cleaner solution --- src/megaapi_impl.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/megaapi_impl.cpp b/src/megaapi_impl.cpp index f341eb9ed0..4f7a40d96d 100644 --- a/src/megaapi_impl.cpp +++ b/src/megaapi_impl.cpp @@ -19362,13 +19362,9 @@ void MegaApiImpl::sendPendingRequests() { if (node->isvalid && ovn->isvalid && *(FileFingerprint*)node == *(FileFingerprint*)ovn) { - e = API_OK; // there is already an identical node in the target folder - // continue to complete the copy-delete - client->restag = request->getTag(); - vector emptyVec; - targettype_t target = client->isForeignNode(newParent->nodehandle) ? USER_HANDLE : NODE_HANDLE; - putnodes_result(API_OK, target, emptyVec); - break; + request->setNodeHandle(UNDEF); + e = client->unlink(node, false, request->getTag()); + break; // request finishes now if error, otherwise on unlink_result } if (!client->versions_disabled)