Assets are overwritten when they have the same name after rename
Bug description
While uploading and renaming files through the Assets Browser, I accidentally used for multiple files the same filename, which caused Statamic to override the existing file with the new one.
How to reproduce

- Upload a file. Rename this file to
test 1 - Upload a second file. Rename this file to
test 1
Result: The first file gets ovewritten by the second file.
After clicking Rename on the second file, I'm getting a Vue error, see below.
Logs
[Vue warn]: Error in event handler for "editor-action-selected": "TypeError: this.findActionComponent(...) is undefined"
TypeError: this.findActionComponent(...) is undefined
actionSelected EditorActions.vue:51
VueJS 2
runAction Editor.vue:404
click Editor.vue:343
VueJS 48
load Editor.vue:297
promise callback*load Editor.vue:295
mounted Editor.vue:271
VueJS 19
edit Browser.vue:550
editAsset AssetManager.vue:130
VueJS 4
click Browser.vue:436
VueJS 2
Environment
Environment
Application Name: Statamic
Laravel Version: 9.52.5
PHP Version: 8.2.5
Composer Version: 2.4.4
Environment: local
Debug Mode: ENABLED
URL: statamic-v3.4.test
Maintenance Mode: OFF
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file
Statamic
Addons: 0
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 3.4.7 PRO
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
runtime (new)
Additional details
Issue #6667 could be related.
Hey 👋
I'm unable to reproduce this issue on the latest version of Statamic. It looks like -1 is appended to the filename to prevent the renamed asset from overwriting the existing one:
I'm going to close this issue now. If you're still experiencing this issue, please leave a comment and we can re-open the issue. Thanks!
Yes, still experiencing this issue. You forgot the first step in your test. You need to rename the first asset directly after uploading.
- Upload a file. Rename this file directly after the upload to
test 1 - Upload a second file. Rename this file to
test 1
I see it now, thanks! I must have missed that part.