]> source.dussan.org Git - nextcloud-server.git/commitdiff
relax permissions mask check for detecting part file rename 21558/head
authorRobin Appelman <robin@icewind.nl>
Thu, 11 Jun 2020 12:22:59 +0000 (14:22 +0200)
committerRobin Appelman <robin@icewind.nl>
Wed, 24 Jun 2020 11:06:14 +0000 (13:06 +0200)
with files drop uploads the original file name isn't always used for the '.ocTransferId' source path

Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Storage/Wrapper/PermissionsMask.php

index 6b453b4380a777d39dcabacfced616fa6ae04ae6..9c2d123b7bfdaf0678c89e1ba6298248f01f12a2 100644 (file)
@@ -80,13 +80,9 @@ class PermissionsMask extends Wrapper {
        }
 
        public function rename($path1, $path2) {
-               $p = strpos($path1, $path2);
-               if ($p === 0) {
-                       $part = substr($path1, strlen($path2));
-                       //This is a rename of the transfer file to the original file
-                       if (strpos($part, '.ocTransferId') === 0) {
-                               return $this->checkMask(Constants::PERMISSION_CREATE) and parent::rename($path1, $path2);
-                       }
+               //This is a rename of the transfer file to the original file
+               if (dirname($path1) === dirname($path2) && strpos($path1, '.ocTransferId') > 0) {
+                       return $this->checkMask(Constants::PERMISSION_CREATE) and parent::rename($path1, $path2);
                }
                return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::rename($path1, $path2);
        }