Skip to content

Commit

Permalink
Merge pull request #45514 from nextcloud/bug/noid/fix-check-for-dark-…
Browse files Browse the repository at this point in the history
…avatar

fix: use different file name for generated dark avatars
  • Loading branch information
kesselb authored Jun 21, 2024
2 parents f56bca3 + 53b5cf6 commit 425e2d0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/private/Avatar/UserAvatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,20 @@ public function remove(bool $silent = false): void {
* @throws NotFoundException
*/
private function getExtension(bool $generated, bool $darkTheme): string {
if ($darkTheme && !$generated) {
if ($this->folder->fileExists('avatar-dark.jpg')) {
return 'jpg';
} elseif ($this->folder->fileExists('avatar-dark.png')) {
return 'png';
}
if ($darkTheme && $generated) {
$name = 'avatar-dark.';
} else {
$name = 'avatar.';
}
if ($this->folder->fileExists('avatar.jpg')) {

if ($this->folder->fileExists($name . 'jpg')) {
return 'jpg';
} elseif ($this->folder->fileExists('avatar.png')) {
}

if ($this->folder->fileExists($name . 'png')) {
return 'png';
}

throw new NotFoundException;
}

Expand Down

0 comments on commit 425e2d0

Please sign in to comment.