This PR adds an additional check in guessFilename(resp *http.Response) function to make sure that the we only read the filename from the Content-disposition header when the filename directive is supplied as it's completely legal and valid [source] for the server to just return inline or attachment directives without supplying the filename
If we can't read the name from the header we simply fallback to URL.Path for filename value.
Excellent PR, thank you! Problem well explained, researched existing issues, fix is succinct, tests with good coverage, existing style honored. Love it.
This PR adds an additional check in
guessFilename(resp *http.Response)
function to make sure that the we only read thefilename
from theContent-disposition
header when thefilename
directive is supplied as it's completely legal and valid [source] for the server to just returninline
orattachment
directives without supplying thefilename
If we can't read the name from the header we simply fallback to
URL.Path
forfilename
value.This PR fixes #64