fix: align download path ownership with category destinations

This commit is contained in:
NimBold
2026-06-19 07:36:02 +03:30
parent 1ae2fe7703
commit 8a1619f056
4 changed files with 138 additions and 80 deletions
+16 -1
View File
@@ -77,7 +77,12 @@ export const DownloadTable: React.FC<DownloadTableProps> = ({ filter }) => {
const getDownloadPath = async (item: DownloadItem) => {
const fileName = item.fileName?.trim();
if (!fileName) return null;
return resolvePath(item.destination || '~/Downloads', fileName);
const settings = useSettingsStore.getState();
const destination = item.destination ||
(settings.downloadDirectories && settings.downloadDirectories[item.category]) ||
settings.defaultDownloadPath ||
'~/Downloads';
return resolvePath(destination, fileName);
};
const openProperties = (id: string) => {
@@ -85,6 +90,11 @@ export const DownloadTable: React.FC<DownloadTableProps> = ({ filter }) => {
};
const openDownloadFile = async (item: DownloadItem) => {
if (item.status !== 'completed') {
openProperties(item.id);
return;
}
const fullPath = await getDownloadPath(item);
if (!fullPath) {
openProperties(item.id);
@@ -100,6 +110,11 @@ export const DownloadTable: React.FC<DownloadTableProps> = ({ filter }) => {
};
const revealDownloadFile = async (item: DownloadItem) => {
if (item.status !== 'completed') {
openProperties(item.id);
return;
}
const fullPath = await getDownloadPath(item);
if (!fullPath) {
openProperties(item.id);