From ce0e4895b5f4a9fa7831da38dd391f9c79939d19 Mon Sep 17 00:00:00 2001 From: Arthur de Moulins Date: Mon, 18 Nov 2024 10:38:23 +0100 Subject: [PATCH] WIP --- databox/api/src/Integration/RemoveBg/RemoveBgClient.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/databox/api/src/Integration/RemoveBg/RemoveBgClient.php b/databox/api/src/Integration/RemoveBg/RemoveBgClient.php index 41fc94059..6821541ec 100644 --- a/databox/api/src/Integration/RemoveBg/RemoveBgClient.php +++ b/databox/api/src/Integration/RemoveBg/RemoveBgClient.php @@ -48,8 +48,11 @@ public function getBgRemoved(File $file, string $apiKey): string } fclose($fileHandler); } catch (\Throwable $e) { - fclose($fileHandler); - @unlink($cacheFile); + if (isset($fileHandler)) { + fclose($fileHandler); + @unlink($cacheFile); + } + throw $e; }