Skip to content
Snippets Groups Projects
Commit 180d82a7 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

qual-sig: Fix URL escaping when fetching the file

There was a workaround for deriving the filename from the source filename
because characters like '#' didn't make it through.

Turns out this was just a bug some lines above where encodeURIComponent()
wasn't used as it should.

Use encodeURIComponent() when constructing the URL and remove the
workaround.
parent bfac70b6
No related branches found
No related tags found
1 merge request!13qual-sig: Fix URL escaping when fetching the file
Pipeline #15648 passed
......@@ -278,8 +278,8 @@ class QualifiedSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitEle
// fetch pdf from api gateway with sessionId
JSONLD.initialize(this.entryPointUrl, (jsonld) => {
const apiUrl = jsonld.getApiUrlForEntityName("QualifiedlySignedDocument") + '/' + sessionId + '?fileName=' +
encodeURI(fileName);
const apiUrl = jsonld.getApiUrlForEntityName("QualifiedlySignedDocument") + '/' + encodeURIComponent(sessionId) + '?fileName=' +
encodeURIComponent(fileName);
fetch(apiUrl, {
headers: {
......@@ -298,8 +298,6 @@ class QualifiedSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitEle
return result.json();
})
.then((document) => {
// PDF-AS garbles some filenames (e.g. containing a '#')
document.signedFilename = this.currentFileName.replace(/\.pdf$/i, '.sig.pdf');
// this doesn't seem to trigger an update() execution
that.signedFiles.push(document);
// this triggers the correct update() execution
......@@ -793,7 +791,7 @@ class QualifiedSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitEle
results.push(html`
<div class="file-block">
<div class="header">
<span class="filename"><strong>${file.signedFilename}</strong> (${humanFileSize(file.contentSize)})</span>
<span class="filename"><strong>${file.name}</strong> (${humanFileSize(file.contentSize)})</span>
<button class="button close"
title="${i18n.t('qualified-pdf-upload.download-file-button-title')}"
@click="${() => { this.downloadFileClickHandler(file); }}">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment