Skip to content

Commit 76ce375

Browse files
author
Sampsa Penna
committed
Skip: Remove subfolders from suggested file download name (merge commit)
Merge branch 'feature/download-filename-without-subs' into 'main' * Remove subfolders from suggested file download name Closes #1237 See merge request https://gitlab.ci.csc.fi/sds-dev/sd-connect/swift-browser-ui/-/merge_requests/322 Approved-by: Sampsa Penna <[email protected]> Co-authored-by: Monika Radaviciute <[email protected]> Merged by Sampsa Penna <[email protected]>
2 parents 0a25e77 + 5766fa1 commit 76ce375

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

swift_browser_ui_frontend/src/common/socket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ export default class UploadSocket {
420420
const fident = objects[0].replace(".c4gh", "")
421421
.match(/(?<!^)\.[^.]{1,}$/g);
422422
const opts = {
423-
suggestedName: objects[0].replace(".c4gh", ""),
423+
suggestedName: objects[0].split("/").at(-1).replace(".c4gh", ""),
424424
};
425425

426426
if (fident) {

swift_browser_ui_frontend/wasm/js/crypt-post-downworker.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,8 @@ if (inServiceWorker) {
611611
const response = new Response(stream);
612612
response.headers.append(
613613
"Content-Disposition",
614-
"attachment; filename=\"" + fileName.replace(".c4gh", "") + "\"",
614+
"attachment; filename=\"" +
615+
fileName.split("/").at(-1).replace(".c4gh", "") + "\"",
615616
);
616617

617618
// Map the streamController as the stream for the download

0 commit comments

Comments
 (0)