Merge pull request #23628 from owncloud/avatar-remove

only remove avatars from the folder we store them in
This commit is contained in:
Thomas Müller 2016-03-30 17:00:09 +02:00
commit 66ee9d56fc
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');