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

feat: add option to preserve the filenam in the link #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Sh4d1
Copy link

@Sh4d1 Sh4d1 commented Apr 25, 2021

This PR add an option to preserve the filename in the link.

It add a dummy hash, in order to stay compliant with the hash.filename files. Also, removed the /id.ext route, and handled the extension case in the /id route.

Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
@moshee
Copy link
Owner

moshee commented Apr 25, 2021

Thanks for the PR! Could you explain the use case for this change so I can understand what the code is intended to accomplish?

@Sh4d1
Copy link
Author

Sh4d1 commented Apr 25, 2021

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

@moshee
Copy link
Owner

moshee commented Apr 25, 2021

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.

@Sh4d1
Copy link
Author

Sh4d1 commented Apr 26, 2021

I was thinking it would be more granular. Also, not sure how to handle the existing files when switching from between the option 🤔

@moshee
Copy link
Owner

moshee commented May 2, 2021

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.

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.

2 participants