only remove avatars from the folder we store them in
This commit is contained in:
parent
dd5bbc31f2
commit
c22697e09e
|
@ -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 {
|
||||||
->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');
|
||||||
|
|
Loading…
Reference in New Issue