From 591c2cb01afcf7ad1d8bd7ce087e86851c1ff8ea Mon Sep 17 00:00:00 2001 From: hopleus Date: Mon, 19 Feb 2024 16:25:43 +0300 Subject: [PATCH 1/2] Fixes for getting the file name in the cases when the file name key is received, but it is empty Signed-off-by: hopleus --- lib/private/Files/FileInfo.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 29922ee30eb00..1550ac92a3854 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -183,7 +183,11 @@ public function getMimePart() { * @return string */ public function getName() { - return isset($this->data['name']) ? $this->data['name'] : basename($this->getPath()); + if (isset($this->data['name']) && !empty($this->data['name'])) { + return $this->data['name']; + } + + return basename($this->getPath()); } /** From deeca104f0486947d53e7582f7e98681d88cf095 Mon Sep 17 00:00:00 2001 From: hopleus Date: Tue, 12 Mar 2024 17:23:59 +0300 Subject: [PATCH 2/2] Refactoring getName function Signed-off-by: hopleus --- lib/private/Files/FileInfo.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 1550ac92a3854..b6a9c86823851 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -183,11 +183,9 @@ public function getMimePart() { * @return string */ public function getName() { - if (isset($this->data['name']) && !empty($this->data['name'])) { - return $this->data['name']; - } - - return basename($this->getPath()); + return empty($this->data['name']) + ? basename($this->getPath()) + : $this->data['name']; } /**