fix(capture): Ensure download filename has the correct extension. (#5691)

This commit is contained in:
Joe Boccanfuso authored and GitHub committed 2026-01-06 15:27:44 -05:00
1 parent a51552a2e7
commit 38a8406a66
1 file changed
+3 -2
@@ -215,7 +215,7 @@ const CornerstoneViewportDownloadForm = ({
} }
}, [viewportDimensions, showAnnotations]); }, [viewportDimensions, showAnnotations]);
const handleDownload = async (filename: string, fileType: string) => { const handleDownload = async (baseFilename: string, fileType: string) => {
const divForDownloadViewport = document.querySelector( const divForDownloadViewport = document.querySelector(
`div[data-viewport-uid="${VIEWPORT_ID}"]` `div[data-viewport-uid="${VIEWPORT_ID}"]`
); );
@@ -225,8 +225,9 @@ const CornerstoneViewportDownloadForm = ({
return; return;
} }
const filename = `${baseFilename}.${fileType}`;
const canvas = await html2canvas(divForDownloadViewport as HTMLElement); const canvas = await html2canvas(divForDownloadViewport as HTMLElement);
downloadUrl(canvas.toDataURL(`image/${fileType}`, 1.0)); downloadUrl(canvas.toDataURL(`image/${fileType}`, 1.0), { filename });
}; };
const ViewportDownloadFormNew = customizationService.getCustomization( const ViewportDownloadFormNew = customizationService.getCustomization(