You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to download a file via Flurl and noticed that file had a gibberish name, but Chrome downloaded the same file with a readable name.
varclient=new FlurlClient(baseUrl);varrequest= client.Request(link).WithAutoRedirect(true).WithCookie(cookieKey, cookieValue);varfileName=await request.DownloadFileAsync(".");// nothing special
After some investigation my suspicion is that DownloadFileAsync (in case of Content-Disposition absence) does not respect redirects and tries to parse file name from the initial request url. But file name can be parsed only from redirected request url in my case and Chrome does exactly that.
I don't know if this behavior is governed by any RFC or something else, so I don't know if it is a bug or not.
Screenshot of the debug values from the breakpoint at DownloadFileAsync:
Thanks for reporting. The combination of redirect + DownloadFileAsync is probably not well covered by tests so I could see this being a legitimate bug. I'll dig deeper when I have some time, but in the mean time you could probably come up with a reasonable work-around that avoids using DownloadFileAsync directly. That implementation might help as a starting point though:
I tried to download a file via Flurl and noticed that file had a gibberish name, but Chrome downloaded the same file with a readable name.
After some investigation my suspicion is that DownloadFileAsync (in case of
Content-Disposition
absence) does not respect redirects and tries to parse file name from the initial request url. But file name can be parsed only from redirected request url in my case and Chrome does exactly that.I don't know if this behavior is governed by any RFC or something else, so I don't know if it is a bug or not.
Screenshot of the debug values from the breakpoint at
DownloadFileAsync
:Versions
The text was updated successfully, but these errors were encountered: