Conversation
|
The download feature is much appreciated but why the need for the database layout change? The whole thing could be a lot simpler by just fetching the raw data from the database and then appending the extension on the response as requested by the user. Similar to how the paste view highlights on demand. |
… download-button
|
My problem was that I couldn't see a way to obtain the extension after the paste was created. Initially I thought it is as easy is getting the extension from Could you point me to an alternative way to obtain the extension when One dirty workaround I could imagine would be to use javascript to parse the extension from |
In the |
|
Thanks a lot, totally missed that possibility. I added an updated version |
|
|
||
| Ok(Response::builder() | ||
| .header(header::CONTENT_TYPE, content_type) | ||
| .header(header::CONTENT_DISPOSITION, content_disposition) |
There was a problem hiding this comment.
I suppose it should be possible to use Response::from_parts together with TypedHeaders to set the headers in a typesafe manner.
There was a problem hiding this comment.
Tried using TypedHeaders but it doesn't seem very ergonomic for Response building. Also, the header for which the Typing is the most important ContentDisposition does not support attachement (see https://docs.rs/headers/latest/src/headers/common/content_disposition.rs.html#56).
I now validated the inputs and put constraints on the static strings. Let me know if this ok.
There was a problem hiding this comment.
It's okay, I will think about it myself a bit. But strange that this old issue is still not resolved.
|
I'll approve and run the workflow but please squash the commits, so |
|
As far as I know you can just choose the squash option when merging with the github ui. Let me know if it doesn't work |
|
I always assume people want to craft their own commits but since you are okay with squashing :-) anyhow, thanks! |
This PR persists the file extension into the database and adds a download button for direct file download