[Pkg-owncloud-commits] [owncloud] 211/457: Use md5 + prefix for file locking keys in memcache

David Prévot taffit at moszumanska.debian.org
Sun Jun 28 20:06:09 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 8d53dc803f978f0b2e5db1c3503dc5fb0d55b0c5
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Wed May 13 12:12:39 2015 +0200

    Use md5 + prefix for file locking keys in memcache
    
    Also trim slashes from paths to make sure the locks are based on the
    same paths.
---
 lib/private/files/storage/common.php | 4 ++--
 lib/private/files/view.php           | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 1c54f7c..f0c9e1b 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -630,7 +630,7 @@ abstract class Common implements Storage {
 	 * @throws \OCP\Lock\LockedException
 	 */
 	public function acquireLock($path, $type, ILockingProvider $provider) {
-		$provider->acquireLock(md5($this->getId() . '::' . $path), $type);
+		$provider->acquireLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type);
 	}
 
 	/**
@@ -639,6 +639,6 @@ abstract class Common implements Storage {
 	 * @param \OCP\Lock\ILockingProvider $provider
 	 */
 	public function releaseLock($path, $type, ILockingProvider $provider) {
-		$provider->releaseLock(md5($this->getId() . '::' . $path), $type);
+		$provider->releaseLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type);
 	}
 }
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 166989e..b499bbb 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -1621,9 +1621,11 @@ class View {
 		if (!$path) {
 			return [];
 		}
+
+		$path = trim($path, '/');
 		$parts = explode('/', $path);
 
-		// remove the singe file
+		// remove the single file
 		array_pop($parts);
 		$result = array('/');
 		$resultPath = '';

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list