[FEAT]: Support for Files Alias Name
Suggestion
I propose adding a new feature to the storage module that allows users to specify an alias name for uploaded files. This functionality will enable users to provide a custom name for each file upon upload, addressing potential duplication issues when files with identical names are uploaded.
To achieve this, I propose we use a generated UUID instead of indexing file names for uniqueness.
My thoughts on implementing this are as follows:
- Make file name optional in file requests. If no name is provided a UUID will be create for file name
- Introduce a new field for requests and the db, where you can specify the name of the file as you want it to appear, but not as you want it stored. Pros: Not breaking, allows for better visualization in the client side Cons: Maybe a bit more complex to understand
Alternatively, we could change the usage of the name field and always use it as an "alias" but not as the way that the file is going to be stored. So files will always be stored with UUIDs, but will appear with the specified name in the db. Pros: Straightforward approach in handling Cons: Potentially breaking change, cannot identify file if you're exploring the storage filesystem, don't have the option to specify the name in the storage.
Thoughts @Renc17, @ChrisPdgn, @kon14 ?
Would it be wrong if we added the naming logic that exists in file systems like: "When you download a file that has an already existing name just append a '(1)' to it" ? That way we don't change anything and we just check the count of files that have this name already and add the suffix.
@ChrisPdgn that's another behaviour that we could look into. In general uniqueness is enforced db-wise I think, can't remember precisely. So a file with name X needs to be unique across everything. But even if we consider container/bucket and folder names, this would work nicely. I don't know if it should be the default behaviour though, or if the strategy should be specified on the settings and/or the request to create the file. Meaning to pick between setting (1), (2) etc. for example or use the uuid to store the file and keep the name in the db
done in #1096