Skip to content

Commit

Permalink
Merge pull request #31865 from owncloud/stable10-aeeb732174ac3eebec8b…
Browse files Browse the repository at this point in the history
…30c07614ac5dde25ea11

[stable10] Fixes #31849 - delete thumbnails on write hooks
  • Loading branch information
phil-davis authored Jun 21, 2018
2 parents 0889cef + a898fb0 commit a0fdde8
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/private/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -1310,11 +1310,22 @@ public static function post_delete_versions($args) {
public static function post_delete($args, $prefix = '') {
$path = Files\Filesystem::normalizePath($args['path']);
if (!isset(self::$deleteFileMapper[$path])) {
return;
$user = isset($args['user']) ? $args['user'] : \OC_User::getUser();
if ($user === false) {
$user = Filesystem::getOwner($path);
}

$userFolder = \OC::$server->getUserFolder($user);
if ($userFolder === null) {
return;
}

$node = $userFolder->get($path);
} else {
/** @var FileInfo $node */
$node = self::$deleteFileMapper[$path];
}

/** @var FileInfo $node */
$node = self::$deleteFileMapper[$path];
$preview = new Preview($node->getOwner()->getUID(), $prefix, $node);
$preview->deleteAllPreviews();
}
Expand Down

0 comments on commit a0fdde8

Please sign in to comment.