Skip to content

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

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

EnvironmentLaravel Version: 13.16.1PHP Version: 8.5.4Composer Version: 2.9.8Environment: localDebug Mode: ENABLEDMaintenance Mode: OFFTimezone: UTCLocale: enCacheConfig: NOT CACHEDEvents: NOT CACHEDRoutes: NOT CACHEDViews: CACHEDDriversBroadcasting: logCache: fileDatabase: mysqlLogs: stack / singleMail: logQueue: syncSession: fileStoragepublic/storage: NOT LINKEDStatamicAddons: 1License Key: Not setSites: 2 (Statamic, Statamic 2)Stache Watcher: Enabled (auto)Static Caching: DisabledVersion: 6.21.0 PROStatamic Addonsstatamic/eloquent-driver: 5.10.0Statamic Eloquent DriverAddon Settings: fileAsset Containers: fileAssets: fileBlueprints: fileCollection Trees: fileCollections: fileEntries: fileFieldsets: fileForm Submissions: fileForms: fileGlobal Sets: fileGlobal Variables: fileNavigation Trees: fileNavigations: fileRevisions: fileSites: fileTaxonomies: fileTerms: fileTokens: file

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions