Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assets are overwritten when they have the same name after rename #8027

Closed
o1y opened this issue Apr 30, 2023 · 3 comments · Fixed by #10959
Closed

Assets are overwritten when they have the same name after rename #8027

o1y opened this issue Apr 30, 2023 · 3 comments · Fixed by #10959
Labels

Comments

@o1y
Copy link
Contributor

o1y commented Apr 30, 2023

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

2023-04-30 12 40 15

  1. Upload a file. Rename this file to test 1
  2. 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.

@duncanmcclean
Copy link
Member

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:

CleanShot 2024-01-09 at 16 16 20

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!

@o1y
Copy link
Contributor Author

o1y commented Jan 9, 2024

Yes, still experiencing this issue. You forgot the first step in your test. You need to rename the first asset directly after uploading.

  1. Upload a file. Rename this file directly after the upload to test 1
  2. Upload a second file. Rename this file to test 1

@duncanmcclean
Copy link
Member

I see it now, thanks! I must have missed that part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants