From 095418493ef909d25808d278ee099fb34070c7fb Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Mon, 23 Nov 2020 23:51:19 +0100 Subject: Use proper methods for display name retrieval Signed-off-by: Morris Jobke --- apps/files_sharing/lib/Cache.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index 25e92d23962..ab8adda725e 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -38,6 +38,7 @@ use OCP\Files\Search\ISearchBinaryOperator; use OCP\Files\Search\ISearchComparison; use OCP\Files\Search\ISearchOperator; use OCP\Files\StorageNotAvailableException; +use OCP\IUserManager; /** * Metadata cache for shared files @@ -174,7 +175,13 @@ class Cache extends CacheJail { private function getOwnerDisplayName() { if (!$this->ownerDisplayName) { - $this->ownerDisplayName = \OC_User::getDisplayName($this->storage->getOwner('')); + $uid = $this->storage->getOwner(''); + $user = \OC::$server->get(IUserManager::class)->get($uid); + if ($user) { + $this->ownerDisplayName = $user->getDisplayName(); + } else { + $this->ownerDisplayName = $uid; + } } return $this->ownerDisplayName; } -- cgit v1.2.3