fix: Large Response Warning download button functionality (#6695)

* fix: Large Response Warning download button functionality
This commit is contained in:
gopu-bruno
2026-01-07 15:23:10 +05:30
committed by GitHub
parent 848825f16a
commit efe94d9c90
3 changed files with 17 additions and 8 deletions

View File

@@ -10,12 +10,14 @@ const LargeResponseWarning = ({ item, responseSize, onRevealResponse }) => {
const { ipcRenderer } = window;
const response = item.response || {};
const saveResponseToFile = () => {
const downloadResponseToFile = () => {
return new Promise((resolve, reject) => {
ipcRenderer
.invoke('renderer:save-response-to-file', response, item.requestSent.url)
.then(() => {
toast.success('Response saved to file');
.invoke('renderer:save-response-to-file', response, item.requestSent.url, item.pathname)
.then((result) => {
if (result && result.success) {
toast.success('Response downloaded to file');
}
resolve();
})
.catch((err) => {
@@ -72,13 +74,13 @@ const LargeResponseWarning = ({ item, responseSize, onRevealResponse }) => {
<Button
icon={<IconDownload size={18} strokeWidth={1.5} />}
iconPosition="left"
onClick={saveResponseToFile}
onClick={downloadResponseToFile}
disabled={!response.dataBuffer}
title="Save response to file"
title="Download response to file"
color="secondary"
size="sm"
>
Save
Download
</Button>
<Button
icon={<IconCopy size={18} strokeWidth={1.5} />}

View File

@@ -24,7 +24,12 @@ const ResponseDownload = forwardRef(({ item, children }, ref) => {
return new Promise((resolve, reject) => {
ipcRenderer
.invoke('renderer:save-response-to-file', response, item?.requestSent?.url, item.pathname)
.then(resolve)
.then((result) => {
if (result && result.success) {
toast.success('Response downloaded to file');
}
resolve();
})
.catch((err) => {
toast.error(get(err, 'error.message') || 'Something went wrong!');
reject(err);

View File

@@ -1717,7 +1717,9 @@ const registerNetworkIpc = (mainWindow) => {
} else {
await writeFile(filePath, data, true);
}
return { success: true, filePath };
}
return { success: false, cancelled: true };
} catch (error) {
return Promise.reject(error);
}