From: Pawel Andruszkiewicz
Date: Fri, 13 Nov 2015 08:13:26 +0000 (+0100)
Subject: [File] Improved check for copy/move operation onto itself.
X-Git-Tag: submit/tizen/20151221.111205^2~35
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a2f050de80e8b82f079d7d493169547af9d9ad0;p=platform%2Fcore%2Fapi%2Fcordova-plugins.git
[File] Improved check for copy/move operation onto itself.
[Verification] Code compiles, pass rate did not change (137/140).
Change-Id: I257fc8b8f2ec91d5afeb658c587168f368427281
Signed-off-by: Pawel Andruszkiewicz
---
diff --git a/src/file/js/Entry.js b/src/file/js/Entry.js
index 47a409b..1b56c28 100644
--- a/src/file/js/Entry.js
+++ b/src/file/js/Entry.js
@@ -59,7 +59,7 @@ var changeFile = function(method, successCallback, errorCallback, args) {
return;
}
- if (rootsUtils.getFullPath(srcURL) === rootsUtils.getFullPath(destURL)) {
+ if (-1 !== (rootsUtils.getFullPath(destURL) + '/').indexOf(rootsUtils.getFullPath(srcURL) + '/')) {
fail(FileError.INVALID_MODIFICATION_ERR, 'Error - Cannot copy/move onto itself.');
return;
}