Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use different file name for generated dark avatars #45514

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

kesselb
Copy link
Contributor

@kesselb kesselb commented May 26, 2024

  • Resolves: noid

Summary

I wondered, while debugging an issue, about many write requests for my generated user avatar.

Likely the condition $darkTheme && !$generated should be $darkTheme && $generated to match the implementation in UserAvatar.getFile.

If you want to reproduce, make sure to NOT have a default generated avatar.

Super edgy, no backports needed.

if ($darkTheme && !$generated) {
if ($this->folder->fileExists('avatar-dark.jpg')) {
return 'jpg';
} elseif ($this->folder->fileExists('avatar-dark.png')) {
return 'png';
}
}
if ($this->folder->fileExists('avatar.jpg')) {
return 'jpg';
} elseif ($this->folder->fileExists('avatar.png')) {
return 'png';
}
throw new NotFoundException;

Screencast.from.2024-05-26.17-13-51.webm

TODO

  • CI
  • Review

Checklist

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@kesselb kesselb self-assigned this May 26, 2024
@kesselb kesselb added bug 3. to review Waiting for reviews labels May 26, 2024
@kesselb kesselb added this to the Nextcloud 30 milestone May 26, 2024
Copy link
Member

@st3iny st3iny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Didn't test but the code looks good.

@kesselb kesselb requested review from a team, ArtificialOwl, icewind1991 and sorbaugh and removed request for a team May 27, 2024 09:37
@kesselb kesselb merged commit 425e2d0 into master Jun 21, 2024
155 checks passed
@kesselb kesselb deleted the bug/noid/fix-check-for-dark-avatar branch June 21, 2024 09:11
@blizzz blizzz mentioned this pull request Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants