Open Bowarc opened 1 month ago
For the download part, as for the filename you need the url to be /<id>/<filename>
for the browser to download as filename
which i don't like (as it adds more complexity and potential attack vector) my idea would be to use an html <a download></a>
.
But that requires to have a href
tag to point to an actual url of the server where the file is served.
Which i can, but meh
Another potential solution would be to pass the file content as the src
part of the a
tag ? If that is even possible.
That would limit the server calls to 1.
Could a route of /<id>
that would get the filename and redirect to /<id>/<filename>
do the job?
It's a redirection so it might break some implementations...
I tried redirections, it works well on browsers, but i have an issue on the curl method, in curl the -O
option is bugged when used with -L
.
Welp Sadge
I mean, you can still normally -o
but you would have to know the file name or come up with one yourself
My idea would be to use an html
<a download></a>
. But that requires to have ahref
tag to point to an actual url of the server where the file is served.
Needs to be tested.
Could be a solution
GET /<uuid>
would give a webpage which would download /GET/<uuid>/<filename>
But that wouldn't work w/ curl
GET /<uuid>
redirects,
GET /<uuid>/<wrong file name>
returns an error message with the correct file name in the text
GET /<uuid>/<file name>
returns the cache content
Now, we need to fix #3
This makes reference of #6 and #7.
I want to rework the api system to use the request type to decide what action you wanna make.
The goal api would be
GET /
-> web_pageGET /<uuid>
download file with given uuidPUT /
upload a fileFor the
GET /<uuid>
i wondered how i could make the browser ask the user for file save instead of displaying the file as content, and i found ! You just need to set Bytes or Binary as content type !!