ngx-filesaver icon indicating copy to clipboard operation
ngx-filesaver copied to clipboard

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

Open pillsilly opened this issue 2 years ago • 2 comments

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.

pillsilly avatar Oct 09 '22 05:10 pillsilly

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

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

to fixed this.

cipchk avatar Oct 09 '22 06:10 cipchk

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.

pillsilly avatar Oct 09 '22 14:10 pillsilly