diff --git a/lib/private/Preview/Storage/ObjectStorePreviewStorage.php b/lib/private/Preview/Storage/ObjectStorePreviewStorage.php index 0a2f5e8f0122b..037588e72c825 100644 --- a/lib/private/Preview/Storage/ObjectStorePreviewStorage.php +++ b/lib/private/Preview/Storage/ObjectStorePreviewStorage.php @@ -56,6 +56,10 @@ public function writePreview(Preview $preview, mixed $stream): int { $store->writeObject($urn, $countStream); } catch (\Exception $exception) { throw new NotPermittedException('Unable to save preview to object store', previous: $exception); + } finally { + if (is_resource($countStream)) { + fclose($countStream); + } } return $size; }