cipchk / ngx-filesaver

Simple file save with FileSaver.js
https://cipchk.github.io/ngx-filesaver/
MIT License
86 stars 18 forks source link

% (as part of the file name) is not supported #37

Open pillsilly opened 2 years ago

pillsilly commented 2 years ago

on https://stackblitz.com/edit/ngx-filesaver , it's reproducible if you add a % in line 56

no error prompted, no uncaught exception, no nothing.

Also I tested the FileSaver implementation it's supported.

cipchk commented 2 years ago

Because ngx-filesaver used of URL parsing, so you can use:

- const fileName = `save%.${type}`;
+ const fileName = encodeURI(`save%.${type}`);

to fixed this.

pillsilly commented 2 years ago

Because ngx-filesaver used of URL parsing, so you can use:

- const fileName = `save%.${type}`;
+ const fileName = encodeURI(`save%.${type}`);

to fixed this.

Thanks for the hint, what about including the encodeURI work inside the lib so that to clients it'll be much more intuitive? If it sounds ok then I am ok providing PR.