feat: fix download ss logic

This commit is contained in:
Rohit
2025-04-30 22:08:39 +05:30
parent eed8ff3024
commit 7b6de7db8d

View File

@@ -510,9 +510,22 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
<AccordionDetails> <AccordionDetails>
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 2 }}> <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 2 }}>
<Button <Button
component="a" onClick={() => {
href={row.binaryOutput[screenshotKeys[currentScreenshotIndex]]} fetch(row.binaryOutput[screenshotKeys[currentScreenshotIndex]])
download={screenshotKeys[currentScreenshotIndex]} .then(response => response.blob())
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = screenshotKeys[currentScreenshotIndex];
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
})
.catch(err => console.error('Download failed:', err));
}}
sx={{ sx={{
color: '#FF00C3', color: '#FF00C3',
textTransform: 'none', textTransform: 'none',