FileSaver.js icon indicating copy to clipboard operation
FileSaver.js copied to clipboard

Included credentials while downloading file

Open agoutam27 opened this issue 4 years ago • 2 comments

agoutam27 avatar Jul 15 '21 09:07 agoutam27

really think you should be downloading a blob on your own, it isn't really the job of filesaver to download files. it's technically bad to download the hole file into the memory and then save it.

It's much better if you can do <a href="link" download="name.txt"> instead. Cookies will be included/sent... it's possible to trigger it with a click.

also if the server can send content-disposition attachment header then that is even better

jimmywarting avatar Jul 15 '21 09:07 jimmywarting

I agree with your comments, @jimmywarting, however the download code is already part of FileSaver. Since this PR is changing existing functionality and touches on security, I'd rather make withCredentials an optional setting, default to false (to preserve current behavior). That way it wouldn't affect anyone who upgrades to latest version without looking.

paulftw avatar Jan 25 '22 11:01 paulftw