From f3a5bd6753f10dc511ee90a1f042477120e0da33 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 24 Mar 2020 18:23:38 +0100 Subject: [PATCH] Fix generated avatars and nophoto cache files Since nextcloud/server#19493 newFile() by default does not write the file anymore. Setting an empty string as content will make it write the file immediate, without having to call putContent() afterwards. Signed-off-by: Joas Schilling --- apps/dav/lib/CardDAV/PhotoCache.php | 4 ++-- lib/private/Avatar/UserAvatar.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/dav/lib/CardDAV/PhotoCache.php b/apps/dav/lib/CardDAV/PhotoCache.php index c02280a0be..99c0d1817c 100644 --- a/apps/dav/lib/CardDAV/PhotoCache.php +++ b/apps/dav/lib/CardDAV/PhotoCache.php @@ -108,7 +108,7 @@ class PhotoCache { $data = $this->getPhoto($card); if ($data === false || !isset($data['Content-Type'])) { - $folder->newFile('nophoto'); + $folder->newFile('nophoto', ''); return; } @@ -116,7 +116,7 @@ class PhotoCache { $extension = self::ALLOWED_CONTENT_TYPES[$contentType] ?? null; if ($extension === null) { - $folder->newFile('nophoto'); + $folder->newFile('nophoto', ''); return; } diff --git a/lib/private/Avatar/UserAvatar.php b/lib/private/Avatar/UserAvatar.php index fb434fc694..485e53c249 100644 --- a/lib/private/Avatar/UserAvatar.php +++ b/lib/private/Avatar/UserAvatar.php @@ -252,7 +252,7 @@ class UserAvatar extends Avatar { $avatar->putContent($data); $ext = 'png'; - $this->folder->newFile('generated'); + $this->folder->newFile('generated', ''); $this->config->setUserValue($this->user->getUID(), 'avatar', 'generated', 'true'); }