File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ interface DelayedDownloadButtonProps {
88 label : string ;
99 className ?: string ;
1010 "data-testid" ?: string ;
11+ downloadFileName ?: string ;
1112}
1213
1314export function DelayedDownloadButton ( {
@@ -16,6 +17,7 @@ export function DelayedDownloadButton({
1617 label,
1718 className = "" ,
1819 "data-testid" : dataTestId ,
20+ downloadFileName,
1921} : DelayedDownloadButtonProps ) {
2022 const [ loading , setLoading ] = useState ( false ) ;
2123
@@ -29,7 +31,7 @@ export function DelayedDownloadButton({
2931 const parts = href . split ( "/" ) ;
3032 const filename = parts [ parts . length - 1 ] . split ( "?" ) [ 0 ] ;
3133
32- link . download = filename ;
34+ link . download = downloadFileName ?? filename ;
3335 document . body . appendChild ( link ) ;
3436 link . click ( ) ;
3537 document . body . removeChild ( link ) ;
Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ export default function SbomDownloadModal({
6060 ( artifacts ?? [ ] ) . map ( ( a ) => a . artifactName ) ,
6161 ) ;
6262
63+ const jsonFileName = `${ assetName } _sbom.json`
64+ const xmlFileName = `${ assetName } _sbom.xml`
65+
6366 return (
6467 < Dialog open = { showSBOMModal } >
6568 < DialogContent setOpen = { setShowSBOMModal } >
@@ -116,6 +119,7 @@ export default function SbomDownloadModal({
116119 />
117120 }
118121 label = { "Download in JSON-Format" }
122+ downloadFileName = { jsonFileName }
119123 />
120124 < DelayedDownloadButton
121125 href = {
@@ -126,6 +130,7 @@ export default function SbomDownloadModal({
126130 }
127131 icon = { < FileCode className = "h-5 w-auto inline-block text-success" /> }
128132 label = { "Download in XML-Format" }
133+ downloadFileName = { xmlFileName }
129134 />
130135 </ div >
131136 < hr className = "mt-6" />
Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ export default function VexDownloadModal({
6060 ( artifacts ?? [ ] ) . map ( ( a ) => a . artifactName ) ,
6161 ) ;
6262
63+ const jsonFileName = `${ assetName } _vex.json`
64+ const xmlFileName = `${ assetName } _vex.xml`
65+
6366 return (
6467 < Dialog open = { showVexModal } >
6568 < DialogContent setOpen = { setShowVexModal } >
@@ -123,6 +126,7 @@ export default function VexDownloadModal({
123126 />
124127 }
125128 label = { "Download in JSON-Format" }
129+ downloadFileName = { jsonFileName }
126130 />
127131 < DelayedDownloadButton
128132 href = {
@@ -133,6 +137,7 @@ export default function VexDownloadModal({
133137 }
134138 icon = { < FileCode className = "h-5 w-auto inline-block text-success" /> }
135139 label = { "Download in XML-Format" }
140+ downloadFileName = { xmlFileName }
136141 />
137142 </ div >
138143 < hr className = "mt-6" />
You can’t perform that action at this time.
0 commit comments