only remove avatars from the folder we store them in

This commit is contained in:
Robin Appelman 2016-03-29 18:52:17 +02:00
parent 456035a750
commit 3cadc45ca5
2 changed files with 2 additions and 3 deletions

View File

@ -134,7 +134,7 @@ class Avatar implements IAvatar {
*/
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())) {

View File

@ -148,8 +148,7 @@ class AvatarTest extends \Test\TestCase {
->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');