From 1e631754d78e98d74ba0d3fb477d5eb815e9dfb3 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 17 Sep 2014 18:50:29 +0200 Subject: Fix share key finding algorithm in various cases Instead of inaccurate pattern matching, use the list of users who we know have access to the file to build the list of share keys. This covers the following cases: - Move/copy files into a subfolder within a share - Unsharing from a user - Deleting files directlry / moving share keys to trashbin --- apps/files_encryption/hooks/hooks.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apps/files_encryption/hooks') diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index b1e7e8c52a5..db4e1fa9428 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -520,7 +520,13 @@ class Hooks { $newKeyfilePath .= '.key'; // handle share-keys - $matches = Helper::findShareKeys($oldShareKeyPath, $view); + $matches = Helper::findShareKeys($pathOld, $oldShareKeyPath, $view); + if (count($matches) === 0) { + \OC_Log::write( + 'Encryption library', 'No share keys found for "' . $pathOld . '"', + \OC_Log::WARN + ); + } foreach ($matches as $src) { $dst = \OC\Files\Filesystem::normalizePath(str_replace($pathOld, $pathNew, $src)); $view->$operation($src, $dst); -- cgit v1.2.3