Unsharing a single file now works
This commit is contained in:
parent
aae9b0b1bf
commit
14eae441eb
|
@ -245,11 +245,13 @@ class Hooks {
|
|||
$util = new Util( $view, $userId );
|
||||
$path = $util->fileIdToPath( $params['itemSource'] );
|
||||
|
||||
// If path is a folder, get all children
|
||||
$allPaths = $util->getPaths( $path );
|
||||
|
||||
foreach ( $allPaths as $path ) {
|
||||
|
||||
if ( ! Keymanager::delShareKey( $view, $userId, $path ) ) {
|
||||
// Unshare each child path
|
||||
if ( ! Keymanager::delShareKey( $view, $params['shareWith'], $path ) ) {
|
||||
|
||||
$failed[] = $path;
|
||||
|
||||
|
|
|
@ -355,6 +355,8 @@ class Keymanager {
|
|||
*/
|
||||
public static function delShareKey( \OC_FilesystemView $view, $userId, $filePath ) {
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
$trimmed = ltrim( $filePath, '/' );
|
||||
$shareKeyPath = '/' . $userId . '/files_encryption/share-keys/' . $trimmed . '.shareKey';
|
||||
|
||||
|
@ -362,16 +364,22 @@ class Keymanager {
|
|||
// true), so we perform our own test
|
||||
if ( $view->file_exists( $shareKeyPath ) ) {
|
||||
|
||||
return $view->unlink( $shareKeyPath );
|
||||
$result = $view->unlink( $shareKeyPath );
|
||||
|
||||
} else {
|
||||
|
||||
trigger_error("Could not delete shareKey; does not exist: $shareKeyPath");
|
||||
|
||||
\OC_Log::write( 'Encryption library', 'Could not delete shareKey; does not exist: "' . $shareKeyPath, \OC_Log::ERROR );
|
||||
|
||||
return false;
|
||||
$result = false;
|
||||
|
||||
}
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue