Skip to content

Commit 38a8406

Browse files
authored
fix(capture): Ensure download filename has the correct extension. (#5691)
1 parent a51552a commit 38a8406

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

extensions/cornerstone/src/utils/CornerstoneViewportDownloadForm.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ const CornerstoneViewportDownloadForm = ({
215215
}
216216
}, [viewportDimensions, showAnnotations]);
217217

218-
const handleDownload = async (filename: string, fileType: string) => {
218+
const handleDownload = async (baseFilename: string, fileType: string) => {
219219
const divForDownloadViewport = document.querySelector(
220220
`div[data-viewport-uid="${VIEWPORT_ID}"]`
221221
);
@@ -225,8 +225,9 @@ const CornerstoneViewportDownloadForm = ({
225225
return;
226226
}
227227

228+
const filename = `${baseFilename}.${fileType}`;
228229
const canvas = await html2canvas(divForDownloadViewport as HTMLElement);
229-
downloadUrl(canvas.toDataURL(`image/${fileType}`, 1.0));
230+
downloadUrl(canvas.toDataURL(`image/${fileType}`, 1.0), { filename });
230231
};
231232

232233
const ViewportDownloadFormNew = customizationService.getCustomization(

0 commit comments

Comments
 (0)