]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix generated avatars and nophoto cache files 20145/head
authorJoas Schilling <coding@schilljs.com>
Tue, 24 Mar 2020 17:23:38 +0000 (18:23 +0100)
committerJoas Schilling <coding@schilljs.com>
Tue, 24 Mar 2020 17:23:38 +0000 (18:23 +0100)
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 <coding@schilljs.com>
apps/dav/lib/CardDAV/PhotoCache.php
lib/private/Avatar/UserAvatar.php

index c02280a0bec61a3cc7c33a3a480212e30a168dee..99c0d1817c3658c9b5f2f9589f46d5d26cef9bbc 100644 (file)
@@ -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;
                }
 
index fb434fc6947c58518c79fd1daee42ce862e470e1..485e53c249d2a1ff46781b9f75689d4b1897e5b3 100644 (file)
@@ -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');
                }