From 4e72ab4bd5cbf987e08d0ca72bef4292e5870d8e Mon Sep 17 00:00:00 2001 From: manuels Date: Wed, 8 May 2013 15:24:25 +0200 Subject: Fix bug in rename() that occures if new filename starts with the old filename --- src/library.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/library.js b/src/library.js index cfe83c6e..aaef2f74 100644 --- a/src/library.js +++ b/src/library.js @@ -3453,7 +3453,9 @@ LibraryManager.library = { } else if (oldObj.isRoot || oldObj.path == FS.currentPath) { ___setErrNo(ERRNO_CODES.EBUSY); return -1; - } else if (newObj.path && newObj.path.indexOf(oldObj.path) == 0) { + } else if (newObj.parentPath && + newObj.parentPath.indexOf(oldObj.parentPath) == 0 && + newObj.parentPath != oldObj.parentPath) { ___setErrNo(ERRNO_CODES.EINVAL); return -1; } else if (newObj.exists && newObj.object.isFolder) { -- cgit v1.2.3-70-g09d2