feat: add option to preserve the filenam in the link#43
Conversation
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
|
Thanks for the PR! Could you explain the use case for this change so I can understand what the code is intended to accomplish? |
|
Yep! Sometimes it's easier to share a file by it's name, rather than a random ID 😄 so it's just an option on the upload to use the filename instead of the ID to store/get the file by it's name |
|
Is there any reason that the behavior has to apply on a per-file basis rather than globally? I think I would prefer the much simpler data model that comes with the latter. This would reduce the scope of the changes (new config field, update Get to lookup by name, and postFile to return the filename in the URL) and avoid adding a special namespace to the file cache. |
|
I was thinking it would be more granular. Also, not sure how to handle the existing files when switching from between the option 🤔 |
|
Sorry about the delay; I don't think I'm comfortable with changing the data model in the suggested way to add what seems to be a niche feature. I would be more open to making a binary option to return links and lookup by filename or hash, but it wouldn't be on a per-file basis. If you need a better link for one file, I would suggest creating an alias using a url shortener service or something. |
This PR add an option to preserve the filename in the link.
It add a
dummyhash, in order to stay compliant with thehash.filenamefiles. Also, removed the/id.extroute, and handled the extension case in the/idroute.