summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/hooks
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-09-17 18:50:29 +0200
committerVincent Petry <pvince81@owncloud.com>2014-09-23 12:33:07 +0200
commit1e631754d78e98d74ba0d3fb477d5eb815e9dfb3 (patch)
tree05baebac1ea899e06571dce381c124f9fdbed37b /apps/files_encryption/hooks
parent4669ea38357f3f33caaf056d859e6318b75b72e1 (diff)
downloadnextcloud-server-1e631754d78e98d74ba0d3fb477d5eb815e9dfb3.tar.gz
nextcloud-server-1e631754d78e98d74ba0d3fb477d5eb815e9dfb3.zip
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
Diffstat (limited to 'apps/files_encryption/hooks')
-rw-r--r--apps/files_encryption/hooks/hooks.php8
1 files changed, 7 insertions, 1 deletions
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);