Skip to content

Asset removed if you replace with same file and "Delete Original" is on, which is the default #11229

Open
@edalzell

Description

@edalzell

Bug description

If you try to replace an asset with a file with the exact same name and the Delete Original Asset is on, which is the default, the image is actually removed.

CleanShot 2024-12-06 at 13 35 33@2x

How to reproduce

  1. Install fresh Statamic site with super user
  2. Open Asset listing
  3. Upload a file
  4. Click on the asset and choose Replace
  5. Upload the same file
  6. Click 'Fix...'
  7. Choose Overwrite Existing File
  8. Note the error toasts you see
  9. Click Replace Asset
  10. Notice there's now no assets in the container.

I would expect the file to be there.

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.34.2
PHP Version: 8.3.14
Composer Version: 2.8.3
Environment: local
Debug Mode: ENABLED
URL: asset-replacing.test
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

Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.42.0 Solo

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

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