-
Notifications
You must be signed in to change notification settings - Fork 6
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
Demo site: browser doesn't always download files when clicking the download button #29
Comments
Hmmm.. I think I am doing just this. Did you try in the demo UI or in the app itself? I tested it for a minute, it works (in the app, with firefox at least), and while the web developer tool doesn't show the download request for some reasons (why??), a file (and even an html file) gets downloaded just fine. Mistery. |
c.Set("Content-Type", item.MimeType)
c.Set("Content-Length", fmt.Sprintf("%d", item.Size))
if forDownload {
c.Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", filepath.Base(fullPath)))
} else {
c.Set("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"", filepath.Base(fullPath)))
} Note to myself, this is the piece of code in version 0.8.0 |
I tested it on your demo site, using Burp Suite proxy to modify the response as it came back to my browser.
Yeah I noticed that too, also in Firefox. I'm not into debugging weird web app frontend shenanigans, so I decided not to poke that bear, and fired up Burp instead. |
Aaaah ok. I'm afraid the demo site just uses mockup services, so I can't set any header... the "proper" app actually works. I could move the site to a serverless backend setup, it would be interesting, also for unifying the codebase... I'll think about it, but it's low priority for now. Maybe. It's interesting, so I could just do it. Would you mind if I leave this open and modify the title to "Demo site: Browser doesn't always..."? |
You do whatever helps you keep track of it best :-) |
Thanks for your time! And I didn't know Burp Suite, I definitely need it if it can act as a proxy like you used it. |
I believe it's because you're sending the header
Content-Disposition: inline
, where it should probably beContent-Disposition: attachment
if you click the download button, so the browser doesn't just show the file in the browser.I did a quick test, and that seems to fix it.
The text was updated successfully, but these errors were encountered: