Problem/Motivation
The Media Folder Management module currently allows users to create multiple folders or upload files with the same name within the same directory level.
This can lead to confusion, ambiguous references, and potential issues when managing media programmatically or through the UI.
Examples:
- Creating two folders named "Logos" under the same parent
- Uploading multiple files named "document.pdf" into the same folder
Steps to reproduce
1. Go to `/file-explorer`
2. Create a folder named "Test"
3. Attempt to create another folder named "Test" in the same location — it succeeds
4. Similarly, upload a file named "image.png" into a folder
5. Upload the same file again — it also succeeds without warning or renaming
Proposed resolution
Implement validation checks to prevent:
- Creating two folders with the same name under the same parent
- Uploading files with duplicate names into the same folder, unless renaming is handled automatically
Suggested behavior:
- Show a validation error when a duplicate name is detected
- Or, append a suffix to create a unique name (e.g., "image-1.png")
Remaining tasks
- [ ] Add uniqueness check when creating a new folder
- [ ] Add uniqueness check when uploading files
- [ ] Provide user feedback when a duplicate is detected
- [ ] Optionally implement automatic renaming logic
User interface changes
- Error message or visual indication when attempting to use a duplicate name
- Optional: UI auto-suggests a unique name if a conflict exists
Data model changes
None expected, unless deeper uniqueness constraints are added to the database layer.