aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-02-24 14:55:57 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-02-24 14:55:57 +0100
commit0daec4b27ea34947691e6c27db8d84c821233a6f (patch)
tree376c2a654f3a37d4891a2a3c558c4f71d51c9222
parentd43dbfa0f2775dd5f9b2d24129e24d7cb67ad643 (diff)
downloadnextcloud-server-0daec4b27ea34947691e6c27db8d84c821233a6f.tar.gz
nextcloud-server-0daec4b27ea34947691e6c27db8d84c821233a6f.zip
Fix tmp file cleaning for bundled previews
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--lib/private/Preview/Bundled.php2
-rw-r--r--lib/private/Preview/ProviderV2.php4
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/private/Preview/Bundled.php b/lib/private/Preview/Bundled.php
index 4da2486b76b..e0551bd392b 100644
--- a/lib/private/Preview/Bundled.php
+++ b/lib/private/Preview/Bundled.php
@@ -33,6 +33,8 @@ abstract class Bundled extends ProviderV2 {
protected function extractThumbnail(File $file, string $path): ?IImage {
$sourceTmp = \OC::$server->getTempManager()->getTemporaryFile();
$targetTmp = \OC::$server->getTempManager()->getTemporaryFile();
+ $this->tmpFiles[] = $sourceTmp;
+ $this->tmpFiles[] = $targetTmp;
try {
$content = $file->fopen('r');
diff --git a/lib/private/Preview/ProviderV2.php b/lib/private/Preview/ProviderV2.php
index 766e00f074a..0cb7eb59e21 100644
--- a/lib/private/Preview/ProviderV2.php
+++ b/lib/private/Preview/ProviderV2.php
@@ -35,7 +35,7 @@ abstract class ProviderV2 implements IProviderV2 {
protected $options;
/** @var array */
- private $tmpFiles = [];
+ protected $tmpFiles = [];
/**
* Constructor
@@ -109,7 +109,7 @@ abstract class ProviderV2 implements IProviderV2 {
/**
* Clean any generated temporary files
*/
- protected function cleanTmpFiles() {
+ protected function cleanTmpFiles(): void {
foreach ($this->tmpFiles as $tmpFile) {
unlink($tmpFile);
}