From 3cadc45ca5020d1ca6ca511e73e576be150e4c44 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 29 Mar 2016 18:52:17 +0200 Subject: [PATCH] only remove avatars from the folder we store them in --- lib/private/avatar.php | 2 +- tests/lib/avatartest.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/private/avatar.php b/lib/private/avatar.php index 4b9d3d824046..3f8038360a40 100644 --- a/lib/private/avatar.php +++ b/lib/private/avatar.php @@ -134,7 +134,7 @@ public function set ($data) { */ public function remove () { $regex = '/^avatar\.([0-9]+\.)?(jpg|png)$/'; - $avatars = $this->folder->search('avatar'); + $avatars = $this->folder->getDirectoryListing(); foreach ($avatars as $avatar) { if (preg_match($regex, $avatar->getName())) { diff --git a/tests/lib/avatartest.php b/tests/lib/avatartest.php index b2b69ac1a6c3..b0ab4cb8b5cd 100644 --- a/tests/lib/avatartest.php +++ b/tests/lib/avatartest.php @@ -148,8 +148,7 @@ public function testSetAvatar() { ->willReturn('avatarX'); $nonAvatarFile->expects($this->never())->method('delete'); - $this->folder->method('search') - ->with('avatar') + $this->folder->method('getDirectoryListing') ->willReturn([$avatarFileJPG, $avatarFilePNG, $resizedAvatarFile, $nonAvatarFile]); $newFile = $this->getMock('\OCP\Files\File');