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

Demo site: browser doesn't always download files when clicking the download button #29

Open
clb92 opened this issue May 8, 2022 · 6 comments
Assignees
Labels
bug Something isn't working demo-site

Comments

@clb92
Copy link

clb92 commented May 8, 2022

I believe it's because you're sending the header Content-Disposition: inline, where it should probably be Content-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.

@proofrock proofrock added the bug Something isn't working label May 8, 2022
@proofrock proofrock self-assigned this May 8, 2022
@proofrock
Copy link
Owner

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.

@proofrock
Copy link
Owner

proofrock commented May 8, 2022

handlers.go:108

	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

@clb92
Copy link
Author

clb92 commented May 8, 2022

Did you try in the demo UI or in the app itself?

I tested it on your demo site, using Burp Suite proxy to modify the response as it came back to my browser.

the web developer tool doesn't show the download request for some reasons (why??)

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.

@proofrock
Copy link
Owner

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..."?

@clb92
Copy link
Author

clb92 commented May 8, 2022

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 :-)

@proofrock proofrock changed the title Browser doesn't always download files when clicking the download button Demo site: browser doesn't always download files when clicking the download button May 8, 2022
@proofrock
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working demo-site
Projects
None yet
Development

No branches or pull requests

2 participants