From 0506288882843ea1f09bf2d0e4cc12bc7cc29f21 Mon Sep 17 00:00:00 2001 From: acsfer Date: Tue, 17 Aug 2021 13:03:45 +0200 Subject: [PATCH 1/2] Fix path of `file_get_contents` Try to fix #28370 and #27441 Avoid pre-pends the `$path` to the user's own storage. --- lib/private/legacy/OC_Image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index 890df2241aff3..f6093b1703d14 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -649,7 +649,7 @@ public function loadFromFile($imagePath = false) { default: // this is mostly file created from encrypted file - $this->resource = imagecreatefromstring(\OC\Files\Filesystem::file_get_contents(\OC\Files\Filesystem::getLocalPath($imagePath))); + $this->resource = imagecreatefromstring(file_get_contents(\OC\Files\Filesystem::getLocalPath($imagePath))); $iType = IMAGETYPE_PNG; $this->logger->debug('OC_Image->loadFromFile, Default', ['app' => 'core']); break; From 99c053e5d97fc39c4258b328e44afd97585921e1 Mon Sep 17 00:00:00 2001 From: acsfer Date: Wed, 18 Aug 2021 15:21:05 +0200 Subject: [PATCH 2/2] Avoid usage of Nextcloud API, use PHP function --- lib/private/legacy/OC_Image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index f6093b1703d14..ab49370c5cd51 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -649,7 +649,7 @@ public function loadFromFile($imagePath = false) { default: // this is mostly file created from encrypted file - $this->resource = imagecreatefromstring(file_get_contents(\OC\Files\Filesystem::getLocalPath($imagePath))); + $this->resource = imagecreatefromstring(file_get_contents($imagePath)); $iType = IMAGETYPE_PNG; $this->logger->debug('OC_Image->loadFromFile, Default', ['app' => 'core']); break;