Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Sources/Avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,20 @@ public function __construct(
$url = new Url($this->original_url, true)->proxied();
}

// An avatar picked out of the gallery is stored as a path relative to
// the avatars directory rather than as a URL, so anything with no
// scheme to it is a file name and not somewhere to fetch from. Saying
// so here means the search below finds it on its second attempt instead
// of guessing from the URL path, which only works out for a forum that
// is not at the root of its domain.
if (empty($this->filename) && !$url->isValid() && !str_contains((string) $url, '://')) {
$name = ltrim(strtr((string) $url, '\\', '/'), '/');

if ($name !== '' && !str_contains($name, ':')) {
$this->filename = $name;
}
}

// If we still don't have a valid URL, try to figure it out.
while (!$url->isValid()) {
$attempt ??= 0;
Expand Down