chore: Martin's revision

This commit is contained in:
pedrooot
2025-08-22 12:09:44 +02:00
parent 505b4907d3
commit 349e05b1d5
2 changed files with 16 additions and 4 deletions
+3
View File
@@ -1507,6 +1507,9 @@ class ProviderViewSet(BaseRLSViewSet):
description="PDF file containing the threatscore report"
),
202: OpenApiResponse(description="The task is in progress"),
401: OpenApiResponse(
description="API key missing or user not Authenticated"
),
403: OpenApiResponse(description="There is a problem with credentials"),
404: OpenApiResponse(
description="The scan has no threatscore reports, or the threatscore report generation task has not started yet"
+13 -4
View File
@@ -348,13 +348,22 @@ export const getThreatscoreReport = async (scanId: string) => {
);
}
const arrayBuffer = await response.arrayBuffer();
const base64 = Buffer.from(arrayBuffer).toString("base64");
const filename = `scan-${scanId}-threatscore.pdf`;
const blob = await response.blob();
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
return {
success: true,
data: base64,
filename: `scan-${scanId}-threatscore.pdf`,
data: url,
filename,
};
} catch (error) {
return {