Skip to content

Asset field contents broken when choosing "Discard and use existing file" #14843

@gavynd6

Description

@gavynd6

Bug description

If you upload a duplicate file into an Asset field, it will ask how you want to fix the conflict. If you select "Discard and use existing file", the field now references an incorrect text path, rather than loading in the existing asset. When you then try to save the entry, the validation fails as it can't find the asset.

How to reproduce

  1. Attempt to upload a known duplicate file into an Asset field

  2. Select "Discard and use existing file" from the Fix menu

Image
  1. The asset is replaced with a text path, not the actual file
Image
  1. Attempt to save the entry. A validation error will occur:
    Asset [undefined::user.png] not found

Logs

Environment

Environment
Laravel Version: 13.16.1
PHP Version: 8.5.4
Composer Version: 2.9.8
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: mysql
Logs: stack / single
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 1
License Key: Not set
Sites: 2 (Statamic, Statamic 2)
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.21.0 PRO

Statamic Addons
statamic/eloquent-driver: 5.10.0

Statamic Eloquent Driver
Addon Settings: file
Asset Containers: file
Assets: file
Blueprints: file
Collection Trees: file
Collections: file
Entries: file
Fieldsets: file
Form Submissions: file
Forms: file
Global Sets: file
Global Variables: file
Navigation Trees: file
Navigations: file
Revisions: file
Sites: file
Taxonomies: file
Terms: file
Tokens: file

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions