[File] Improved check for copy/move operation onto itself.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Fri, 13 Nov 2015 08:13:26 +0000 (09:13 +0100)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Fri, 13 Nov 2015 08:13:26 +0000 (09:13 +0100)
[Verification] Code compiles, pass rate did not change (137/140).

Change-Id: I257fc8b8f2ec91d5afeb658c587168f368427281
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/file/js/Entry.js

index 47a409b..1b56c28 100644 (file)
@@ -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;
   }