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

[5.x] Improve duplicate asset upload handling #10959

Merged
merged 21 commits into from
Oct 16, 2024
Merged

Conversation

jasonvarga
Copy link
Member

@jasonvarga jasonvarga commented Oct 15, 2024

This improves the UX regarding file uploads in the assets section, the assets fieldtype, and the asset browser within the fieldtype.

You will now be presented with various options when uploading a file that already exists at the destination path.

CleanShot 2024-10-16 at 14 16 45

  • Overwrite existing file
    The same behavior as the "reupload asset" action. The file will be replaced. Data (alt text, etc) will remain the same.
  • Choose new filename...
    A modal will open to allow you to enter a new filename. Essentially the same as renaming the file on your computer and reuploading.
  • Append timestamp
    This is the current behavior. The file will be uploaded with a timestamp appended.
  • Discard and use existing file
    When used in an asset fieldtype or the selector stack, this will discard your upload and instead select the existing asset.

This PR also prevents you from renaming assets to ones that already exist. You will now get a validation error. The error will guide you on a more appropriate option based on whether the file seems to be identical.

CleanShot 2024-10-16 at 14 20 29

In the future we might be able to make the suggestion actionable from there, but at the moment it would likely require big changes to how actions work.

Closes statamic/ideas#401
Fixes #8027

@jasonvarga jasonvarga marked this pull request as draft October 15, 2024 18:05
@jasonvarga jasonvarga marked this pull request as ready for review October 16, 2024 18:18
@jasonvarga jasonvarga merged commit c8ae481 into 5.x Oct 16, 2024
17 checks passed
@jasonvarga jasonvarga deleted the duplicate-asset-handling branch October 16, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assets are overwritten when they have the same name after rename Ask for overwrite assets
1 participant