fix: failing to move downloaded file from temp to download folder in some linux distros

This commit is contained in:
2025-07-20 12:39:07 +05:30
parent a874cf8cd1
commit 2f4c363e1c

View File

@@ -273,19 +273,10 @@ export default function App({ children }: { children: React.ReactNode }) {
setErroredDownloadId(downloadId);
}
} else {
downloadStatusUpdater.mutate({ download_id: downloadId, download_status: 'completed' }, {
onSuccess: (data) => {
console.log("Download status updated successfully:", data);
queryClient.invalidateQueries({ queryKey: ['download-states'] });
},
onError: (error) => {
console.error("Failed to update download status:", error);
}
})
if (await fs.exists(tempDownloadPath)) {
downloadFilePath = await generateSafeFilePath(downloadFilePath);
await fs.rename(tempDownloadPath, downloadFilePath);
await fs.copyFile(tempDownloadPath, downloadFilePath);
await fs.remove(tempDownloadPath);
}
downloadFilePathUpdater.mutate({ download_id: downloadId, filepath: downloadFilePath }, {
@@ -297,6 +288,16 @@ export default function App({ children }: { children: React.ReactNode }) {
console.error("Failed to update download filepath:", error);
}
})
downloadStatusUpdater.mutate({ download_id: downloadId, download_status: 'completed' }, {
onSuccess: (data) => {
console.log("Download status updated successfully:", data);
queryClient.invalidateQueries({ queryKey: ['download-states'] });
},
onError: (error) => {
console.error("Failed to update download status:", error);
}
})
}
});