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

Check for missing filename directive in Content-disposition #67

Merged
merged 1 commit into from
Oct 26, 2019

Conversation

riyaz-ali
Copy link
Contributor

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.

This PR fixes #64

@cavaliercoder
Copy link
Collaborator

Excellent PR, thank you! Problem well explained, researched existing issues, fix is succinct, tests with good coverage, existing style honored. Love it.

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.

Grab can't determine filename with an URL where this looks pretty easy
2 participants