[TOB-463] fix: Use URL encoding for email attachments
Signed-off-by: Christopher Keim <keim@develop-group.de>
diff --git a/package-lock.json b/package-lock.json
index 2e75d93..1226092 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "openkonsequenz-statement-public-affairs",
- "version": "1.0.0",
+ "version": "1.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 35ed20a..6d49ceb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"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": {
diff --git a/src/app/store/mail/effects/download/download-email-attachment.effect.spec.ts b/src/app/store/mail/effects/download/download-email-attachment.effect.spec.ts
index f3d6b2d..537151c 100644
--- a/src/app/store/mail/effects/download/download-email-attachment.effect.spec.ts
+++ b/src/app/store/mail/effects/download/download-email-attachment.effect.spec.ts
@@ -80,13 +80,14 @@
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([]);
});
diff --git a/src/app/store/mail/effects/download/download-email-attachment.effect.ts b/src/app/store/mail/effects/download/download-email-attachment.effect.ts
index db89594..4a45876 100644
--- a/src/app/store/mail/effects/download/download-email-attachment.effect.ts
+++ b/src/app/store/mail/effects/download/download-email-attachment.effect.ts
@@ -39,6 +39,7 @@
}
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;