Skip to content
Snippets Groups Projects
Commit 66ee9d56 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #23628 from owncloud/avatar-remove

only remove avatars from the folder we store them in
parents 748a59db c22697e0
No related branches found
No related tags found
No related merge requests found
...@@ -134,7 +134,7 @@ class Avatar implements IAvatar { ...@@ -134,7 +134,7 @@ class Avatar implements IAvatar {
*/ */
public function remove () { public function remove () {
$regex = '/^avatar\.([0-9]+\.)?(jpg|png)$/'; $regex = '/^avatar\.([0-9]+\.)?(jpg|png)$/';
$avatars = $this->folder->search('avatar'); $avatars = $this->folder->getDirectoryListing();
foreach ($avatars as $avatar) { foreach ($avatars as $avatar) {
if (preg_match($regex, $avatar->getName())) { if (preg_match($regex, $avatar->getName())) {
......
...@@ -148,8 +148,7 @@ class AvatarTest extends \Test\TestCase { ...@@ -148,8 +148,7 @@ class AvatarTest extends \Test\TestCase {
->willReturn('avatarX'); ->willReturn('avatarX');
$nonAvatarFile->expects($this->never())->method('delete'); $nonAvatarFile->expects($this->never())->method('delete');
$this->folder->method('search') $this->folder->method('getDirectoryListing')
->with('avatar')
->willReturn([$avatarFileJPG, $avatarFilePNG, $resizedAvatarFile, $nonAvatarFile]); ->willReturn([$avatarFileJPG, $avatarFilePNG, $resizedAvatarFile, $nonAvatarFile]);
$newFile = $this->getMock('\OCP\Files\File'); $newFile = $this->getMock('\OCP\Files\File');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment