delete share keys if file gets deleted
This commit is contained in:
parent
5f233ee814
commit
b1d620300e
|
@ -363,14 +363,21 @@ class Keymanager {
|
||||||
|
|
||||||
\OC_FileProxy::$enabled = false;
|
\OC_FileProxy::$enabled = false;
|
||||||
|
|
||||||
$trimmed = ltrim( $filePath, '/' );
|
$util = new Util( $view, $userId );
|
||||||
$shareKeyPath = '/' . $userId . '/files_encryption/share-keys/' . $trimmed . '.shareKey';
|
|
||||||
|
|
||||||
// Unlink doesn't tell us if file was deleted (not found returns
|
list($owner, $filename) = $util->getUidAndFilename($filePath);
|
||||||
// true), so we perform our own test
|
|
||||||
if ( $view->file_exists( $shareKeyPath ) ) {
|
|
||||||
|
|
||||||
$result = $view->unlink( $shareKeyPath );
|
$shareKeyPath = '/' . $owner . '/files_encryption/share-keys/' . $filename;
|
||||||
|
|
||||||
|
$absPath = $view->getLocalFile($shareKeyPath);
|
||||||
|
|
||||||
|
$matches = glob(preg_quote($absPath).'.*.shareKey' );
|
||||||
|
|
||||||
|
if ( $matches ) {
|
||||||
|
|
||||||
|
foreach ( $matches as $ma ) {
|
||||||
|
unlink($ma);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue