-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Milestone
Description
Problem
As an app developer, I want to rename a file. Therefore, I call OC\Files\Node\Node.move(...) which calls OC\Files\View.rename(...). If the rename fails (e.g. due to an illegal file name), then an InvalidPathException is thrown. The problem is, that the file is still locked, even if I catch the exception.
Cause
The reason is that OC\Files\View.rename(...) locks the old and new path, but it doesn't unlock them if an exception is thrown, e.g. by verifyPath(...).
Solution
As a solution, I suggest to move the code of OC\Files\View.rename(...) after locking into a try-catch-finally block in order to ensure that the locks are always freed.
If you agree, I can provide a PR for this.