@@ -22,6 +22,16 @@ const fragment = graphql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
function getFilenameFromUrl(url: string): string | null {
|
||||||
|
try {
|
||||||
|
const disposition = new URL(url).searchParams.get("response-content-disposition");
|
||||||
|
const match = disposition?.match(/filename="([^"]+)"/);
|
||||||
|
return match ? decodeURIComponent(match[1]) : null;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function ElectronicSignatureSection({
|
export function ElectronicSignatureSection({
|
||||||
fragmentRef,
|
fragmentRef,
|
||||||
}: {
|
}: {
|
||||||
@@ -55,9 +65,10 @@ export function ElectronicSignatureSection({
|
|||||||
href={signature.certificateFileUrl}
|
href={signature.certificateFileUrl}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="text-sm text-txt-accent hover:underline"
|
className="text-sm text-txt-primary hover:underline"
|
||||||
|
download
|
||||||
>
|
>
|
||||||
{__("Download")}
|
{getFilenameFromUrl(signature.certificateFileUrl) ?? __("Download")}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user