From 0a2f050de80e8b82f079d7d493169547af9d9ad0 Mon Sep 17 00:00:00 2001 From: Pawel Andruszkiewicz Date: Fri, 13 Nov 2015 09:13:26 +0100 Subject: [PATCH] [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 --- src/file/js/Entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.7.4