mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2025-12-19 16:42:58 +05:30
fix: failing to move downloaded file from temp to download folder in some linux distros
This commit is contained in:
23
src/App.tsx
23
src/App.tsx
@@ -273,19 +273,10 @@ export default function App({ children }: { children: React.ReactNode }) {
|
|||||||
setErroredDownloadId(downloadId);
|
setErroredDownloadId(downloadId);
|
||||||
}
|
}
|
||||||
} else {
|
} 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)) {
|
if (await fs.exists(tempDownloadPath)) {
|
||||||
downloadFilePath = await generateSafeFilePath(downloadFilePath);
|
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 }, {
|
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);
|
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);
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user