Skip to content

CP header avatar has no src when the avatar asset is in a private container #15605

Closed

Description

@theRealPadster

Bug description

When a user's avatar field points to an asset in a private asset container, the avatar in the CP header renders as an <img> with no src attribute, so the browser shows a broken image.

The header reads user.avatar.permalink. The user comes from JavascriptComposer::user() as $user->toAugmentedCollection(), so avatar is the augmented asset, and AssetContainer::url() returns null for a private container. The permalink is therefore null.

$user->avatar() already handles this case. It returns the CP thumbnail URL (/cp/thumbnails/{id}/small/square), which works for private assets. It's also what ListedUser uses, so avatars in the Users listing are fine. Only the header (and anywhere else reading avatar.permalink) breaks.

Expected: the header shows the avatar using the same URL $user->avatar() returns.

How to reproduce

  1. Create an asset container on a disk with 'visibility' => 'private' and no url (a private S3 bucket, or a local disk outside public/).
  2. In the user blueprint, point the avatar assets field at that container.
  3. Upload an avatar for your user and save.
  4. Reload the CP. The avatar in the top-right header is broken, and its <img> has no src.

Logs

None. Nothing is logged.

Environment

Environment
Laravel Version: 13.24.0
PHP Version: 8.4.25
Composer Version: 2.10.2
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 2
License Key: Set
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.31.0 PRO

Statamic Addons
aerni/zipper: 2.5.1
statamic/seo-pro: 7.13.3

Installation

Fresh statamic/statamic site via CLI

Additional details

Reproduced on 6.31.0. The relevant code is unchanged in 6.35.1 (JavascriptComposer::user() and AssetContainer::url()). A fix might be to merge 'avatar' => $user->avatar() (or a dedicated avatar_url) into the array JavascriptComposer::user() returns, and have the header read that instead of avatar.permalink.

Activity

  1. changed the title [-][6.x] CP header avatar has no src when the avatar asset is in a private container[/-] [+]CP header avatar has no src when the avatar asset is in a private container[/+] on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions