cavaliergopher / grab

A download manager package for Go
BSD 3-Clause "New" or "Revised" License
1.39k stars 150 forks source link

extract filename from url if content-disposition header is not present #47

Closed hbakhtiyor closed 5 years ago

hbakhtiyor commented 5 years ago

try to extract filename from url, if can't get from headers, for example http://example.com/example.zip?foo=bar&bar=too

cavaliercoder commented 5 years ago

This is already supported and tested in TestFilenameResolution: https://github.com/cavaliercoder/grab/blob/master/client_test.go#L25.

Do you have an example where this is not working?

hbakhtiyor commented 5 years ago

for example, link

cavaliercoder commented 5 years ago

Hey I'm really confused about this issue. When I test the linked URL you gave, the filename is correctly resolved for me as hello.txt. And your first example correctly resolves to example.zip.

The existing tests (TestURLFilenames and TestFilenameResolution) already test for similar use cases - all without Content-Disposition headers.

Can you please try to elaborate on this issue with a clear example of a failing test?

cavaliercoder commented 5 years ago

Closing due to inactivity. Please reopen and provide additional context if this is still important.