Commit 2c1d1b47 authored by Christopher Keim's avatar Christopher Keim
Browse files

[TOB-463] fix: Use URL encoding for email attachments


Signed-off-by: Christopher Keim's avatarChristopher Keim <keim@develop-group.de>
parent 8967b393
{
"name": "openkonsequenz-statement-public-affairs",
"version": "1.0.0",
"version": "1.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "openkonsequenz-statement-public-affairs",
"version": "1.0.0",
"version": "1.0.1",
"description": "Statement Public Affairs",
"license": "Eclipse Public License - v 2.0",
"repository": {
......
......@@ -80,13 +80,14 @@ describe("DownloadEmailAttachmentEffect", () => {
it("should download email attachments", () => {
const mailId = "<Mail19>";
const name = "attachment.pdf";
const encodedName = encodeURI(name);
const results: Action[] = [];
const spy = spyOn(effect.downloadService, "startDownload");
subscription = effect.download(mailId, name).subscribe((_) => results.push(_));
expect(subscription.closed).toBeTrue();
expect(spy).toHaveBeenCalledWith(`/mail/identifier/${mailId}/${name}`, token);
expect(spy).toHaveBeenCalledWith(`/mail/identifier/${mailId}/${encodedName}`, token);
expect(results).toEqual([]);
});
......
......@@ -39,6 +39,7 @@ export class DownloadEmailAttachmentEffect {
}
public download(mailId: string, name: string): Observable<Action> {
name = encodeURI(name);
const endPoint = `/mail/identifier/${mailId}/${name}`;
this.downloadService.startDownload(urlJoin(this.spaBackendRoute, endPoint), this.authService.token);
return EMPTY;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment