-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix #783 duplicate uploading same asset name #853
Conversation
Thanks for digging into this, @Dammmien! Definitely something the CMS needs. So there's a bit of complexity to consider:
We refer to the non-Git asset stores as "integrations", and your fix would need to be applied only in the absence of an asset integration. We also probably want this functionality in a Redux action rather than in the component itself. Here's the associated action: You'll notice a bunch of it is conditionally run if there's an integration, and the rest runs if not - that last part is where you'll want to run your check and throw the prompt. I know GitHub won't paginate file results, and we can worry about other backends (e.g. GitLab/Bitbucket) as they get merged in. If you can make that change, we should be in good shape to merge. Thanks again for your work! |
@erquhart, not sure to understand, something like the last commit ? |
src/actions/mediaLibrary.js
Outdated
return dispatch(mediaPersistFailed({ privateUpload })); | ||
} | ||
|
||
const deletedFile = await deleteMedia(existingFile, { privateUpload }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleteMedia
returns a function, why not just dispatch it?
Yep, and I linked to the wrong action, but I see that didn't throw you off :) Just one comment in my review and this should be good! |
Hmm no deploy preview for some reason. Going to sanity check it locally before approving, but looks good - thanks @Dammmien! |
@Dammmien I pushed an update to get all existing file logic into the action. There's still an outstanding issue where the last file uploaded in the current session doesn't get caught in the check, we should get that straightened before merging. |
Deploy preview ready! Built with commit 8711fa2 |
Note: we should also fix #540 here by making the check case-insensitive. |
Deploy preview ready! Built with commit 8711fa2 |
@erquhart I pushed an update to compare file name and existing files names in lower case to make the check case-insensitive. |
d373deb
to
8711fa2
Compare
#783 duplicate uploading same asset name
- Summary
Fixes #783 Duplicate uploading same asset name
- Test plan
Upload an image with the same name, it will ask you to replace the existing one.
- Description for the changelog
Juste check existing files name