mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-01-23 00:06:08 +01:00
Update downloader.js
This commit is contained in:
parent
9e30918aae
commit
b9a014b5c7
@ -167,6 +167,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFilenameFromContentDisposition(contentDisposition) {
|
||||||
|
let filename;
|
||||||
|
|
||||||
|
if (contentDisposition && contentDisposition.indexOf("attachment") !== -1) {
|
||||||
|
filename = decodeURIComponent(contentDisposition.split("filename=")[1].replace(/"/g, "")).trim();
|
||||||
|
} else {
|
||||||
|
// If the Content-Disposition header is not present or does not contain the filename, use a default filename
|
||||||
|
filename = "download";
|
||||||
|
}
|
||||||
|
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
async function handleJsonResponse(response) {
|
async function handleJsonResponse(response) {
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
const errorMessage = JSON.stringify(json, null, 2);
|
const errorMessage = JSON.stringify(json, null, 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user