Skip to content

A full-featured download manager.

fix(downloads): explain file opening failures (#2370)

Dr_rOot1b2a11c83ece
diff --git a/e2e/downloads-visibility.spec.ts b/e2e/downloads-visibility.spec.ts
index 2a105a32..a4aa48fc 100644
--- a/e2e/downloads-visibility.spec.ts
+++ b/e2e/downloads-visibility.spec.ts
@@ -1,6 +1,10 @@
import type { ElectronApplication, Locator } from '@playwright/test'
-import { DownloadErrorCode } from '@shared/errors'
+import { DownloadErrorCode, ErrorCode } from '@shared/errors'
import { Commands } from '@shared/protocol/commands'
+import {
+ makeProtocolFailure,
+ makeProtocolSuccess,
+} from '@shared/protocol/errors'
import { Events } from '@shared/protocol/events'
import { Queries } from '@shared/protocol/queries'
import {
@@ -1864,28 +1868,32 @@ test('context actions open files, select download files, reorder the queue and c
files: Queries.GetTaskFiles,
select: Commands.SetSelectedFiles,
}
- await electronApp.evaluate(({ ipcMain }, channels) => {
- const calls: Array<{ channel: string; payload: unknown }> = []
- Object.assign(globalThis, { menuActionCalls: calls })
- for (const channel of Object.values(channels)) {
- ipcMain.removeHandler(channel)
- ipcMain.handle(channel, (_event, payload) => {
- calls.push({ channel, payload })
- if (channel === channels.files)
- return [0, 1, 2].map((index) => ({
- index,
- path: `File ${index}.bin`,
- size: 1000,
- selected: index === 0,
- completedBytes: 0,
- uris: [],
- }))
- if (channel === channels.move)
- return { moved: payload.taskIds, unchanged: [], failed: [] }
- return undefined
- })
- }
- }, channels)
+ await electronApp.evaluate(
+ ({ ipcMain }, { channels, openResult }) => {
+ const calls: Array<{ channel: string; payload: unknown }> = []
+ Object.assign(globalThis, { menuActionCalls: calls })
+ for (const channel of Object.values(channels)) {
+ ipcMain.removeHandler(channel)
+ ipcMain.handle(channel, (_event, payload) => {
+ calls.push({ channel, payload })
+ if (channel === channels.open) return openResult
+ if (channel === channels.files)
+ return [0, 1, 2].map((index) => ({
+ index,
+ path: `File ${index}.bin`,
+ size: 1000,
+ selected: index === 0,
+ completedBytes: 0,
+ uris: [],
+ }))
+ if (channel === channels.move)
+ return { moved: payload.taskIds, unchanged: [], failed: [] }
+ return undefined
+ })
+ }
+ },
+ { channels, openResult: makeProtocolSuccess(null) }
+ )
const getCalls = () =>
electronApp.evaluate(
() =>
@@ -1947,7 +1955,8 @@ test('context actions open files, select download files, reorder the queue and c
await row('menu-bt').click({ button: 'right' })
await mainWindow
.getByRole('menuitem', { name: 'Download order', exact: true })
- .hover()
+ .focus()
+ await mainWindow.keyboard.press('ArrowRight')
await expect(
mainWindow.getByRole('menuitem', { name: 'Move to Front', exact: true })
).toBeVisible()
@@ -2016,14 +2025,18 @@ test('inspector opens a completed file in a compact window', async ({
await setTaskInspectorContentSize(electronApp, mainWindow, 1280, 900)
await mainWindow.getByRole('link', { name: 'Downloads', exact: true }).click()
await expect(mainWindow.getByTestId('downloads-loading')).toHaveCount(0)
- await electronApp.evaluate(({ ipcMain }, channel) => {
- const calls: unknown[] = []
- Object.assign(globalThis, { inspectorOpenFileCalls: calls })
- ipcMain.removeHandler(channel)
- ipcMain.handle(channel, (_event, payload) => {
- calls.push(payload)
- })
- }, Commands.OpenTaskFile)
+ await electronApp.evaluate(
+ ({ ipcMain }, { channel, result }) => {
+ const calls: unknown[] = []
+ Object.assign(globalThis, { inspectorOpenFileCalls: calls })
+ ipcMain.removeHandler(channel)
+ ipcMain.handle(channel, (_event, payload) => {
+ calls.push(payload)
+ return result
+ })
+ },
+ { channel: Commands.OpenTaskFile, result: makeProtocolSuccess(null) }
+ )
await publish(electronApp, [
makeDownloadTask({
id: 'inspector-completed',
@@ -2065,6 +2078,168 @@ test('inspector opens a completed file in a compact window', async ({
await expect(inspector).toHaveCount(0)
})
+for (const surface of ['inspector', 'context menu'] as const) {
+ test(`Open file explains an unavailable default app from the ${surface}`, async ({
+ electronApp,
+ mainWindow,
+ }, testInfo) => {
+ await waitForEngineReady(mainWindow)
+ await setTaskInspectorContentSize(electronApp, mainWindow, 1280, 900)
+ await mainWindow
+ .getByRole('link', { name: 'Downloads', exact: true })
+ .click()
+ await expect(mainWindow.getByTestId('downloads-loading')).toHaveCount(0)
+ await electronApp.evaluate(
+ ({ ipcMain }, { channel, failure, success }) => {
+ let failed = false
+ ipcMain.removeHandler(channel)
+ ipcMain.handle(channel, () => {
+ if (failed) return success
+ failed = true
+ return failure
+ })
+ },
+ {
+ channel: Commands.OpenTaskFile,
+ failure: makeProtocolFailure({
+ code: ErrorCode.TaskOpenAppFailed,
+ message: 'No application available',
+ }),
+ success: makeProtocolSuccess(null),
+ }
+ )
+ await publish(electronApp, [
+ makeDownloadTask({
+ id: 'open-file-app-failure',
+ name: 'Completed.bin',
+ status: TaskStatus.Completed,
+ fileCount: 1,
+ finalPath: '/downloads/Completed.bin',
+ diskPath: '/downloads/Completed.bin',
+ }),
+ ])
+ const row = mainWindow.locator('[data-task-id="open-file-app-failure"]')
+ if (surface === 'inspector') {
+ await row.dblclick()
+ await mainWindow
+ .getByRole('button', { name: 'Open file', exact: true })
+ .click()
+ } else {
+ await row.click({ button: 'right' })
+ await mainWindow
+ .getByRole('menuitem', { name: 'Open file', exact: true })
+ .click()
+ }
+ await expect(
+ mainWindow.getByText('Could not open file', { exact: true })
+ ).toBeVisible()
+ await expect(
+ mainWindow.getByText(
+ 'The system could not open this file. Check that its default app is still installed, or use Open folder to choose another app.',
+ { exact: true }
+ )
+ ).toBeVisible()
+ await expect(
+ mainWindow.getByText(
+ /Error invoking remote method|No application available|AppError/
+ )
+ ).toHaveCount(0)
+ await expect
+ .poll(() =>
+ mainWindow
+ .getByText('Could not open file', { exact: true })
+ .evaluate(
+ (title) =>
+ getComputedStyle(title.parentElement!.parentElement!).opacity
+ )
+ )
+ .toBe('1')
+ await mainWindow.screenshot({
+ path: testInfo.outputPath('open-file-app-failure.png'),
+ animations: 'disabled',
+ })
+ if (surface === 'inspector') {
+ await expect(
+ mainWindow.getByRole('button', { name: 'Open file', exact: true })
+ ).toBeEnabled()
+ await mainWindow
+ .getByRole('button', { name: 'Open file', exact: true })
+ .click()
+ } else {
+ await row.click({ button: 'right' })
+ await mainWindow
+ .getByRole('menuitem', { name: 'Open file', exact: true })
+ .click()
+ await expect(mainWindow.getByRole('menu')).toHaveCount(0)
+ }
+ })
+}
+
+for (const surface of ['context menu', 'More menu'] as const) {
+ test(`Re-download is available from the ${surface} and opens confirmation`, async ({
+ electronApp,
+ mainWindow,
+ }, testInfo) => {
+ await waitForEngineReady(mainWindow)
+ await setTaskInspectorContentSize(electronApp, mainWindow, 1280, 900)
+ await mainWindow
+ .getByRole('link', { name: 'Downloads', exact: true })
+ .click()
+ await expect(mainWindow.getByTestId('downloads-loading')).toHaveCount(0)
+ await electronApp.evaluate(({ ipcMain }, channel) => {
+ ipcMain.removeHandler(channel)
+ ipcMain.handle(channel, () => ({ exists: true }))
+ }, Queries.CheckTaskFileExists)
+ await publish(electronApp, [
+ makeDownloadTask({
+ id: 'redownload-menu',
+ name: 'Completed.bin',
+ status: TaskStatus.Completed,
+ fileCount: 1,
+ uris: ['https://example.test/Completed.bin'],
+ saveDir: '/downloads',
+ finalName: 'Completed.bin',
+ finalPath: '/downloads/Completed.bin',
+ diskPath: '/downloads/Completed.bin',
+ }),
+ ])
+ const row = mainWindow.locator('[data-task-id="redownload-menu"]')
+ if (surface === 'context menu') await row.click({ button: 'right' })
+ else {
+ await row.click()
+ await mainWindow
+ .getByRole('button', { name: 'More', exact: true })
+ .click()
+ }
+ const action = mainWindow.getByRole('menuitem', {
+ name: 'Re-download',
+ exact: true,
+ })
+ await expect(action).toBeVisible()
+ await expect(action).toBeEnabled()
+ await mainWindow.screenshot({
+ path: testInfo.outputPath('redownload-menu.png'),
+ animations: 'disabled',
+ })
+ await action.click()
+ const dialog = mainWindow.getByRole('alertdialog', {
+ name: 'File Already Exists',
+ })
+ await expect(dialog).toBeVisible()
+ await expect(dialog).toContainText('Completed.bin')
+ await expect(
+ dialog.getByRole('button', { name: 'Re-download', exact: true })
+ ).toBeEnabled()
+ await mainWindow.screenshot({
+ path: testInfo.outputPath('redownload-confirmation.png'),
+ animations: 'disabled',
+ })
+ await dialog.getByRole('button', { name: 'Cancel', exact: true }).click()
+ await expect(dialog).toHaveCount(0)
+ await expect(row).toBeVisible()
+ })
+}
+
for (const [locale, downloads, createdColumn] of [
['en-US', 'Downloads', 'Date created'],
['zh-CN', '下载', '创建时间'],
diff --git a/scripts/server-package-size-budgets.json b/scripts/server-package-size-budgets.json
index 7e2548d6..2f02836b 100644
--- a/scripts/server-package-size-budgets.json
+++ b/scripts/server-package-size-budgets.json
@@ -1,6 +1,6 @@
{
"schemaVersion": 1,
- "artifactBytes": 50397184,
+ "artifactBytes": 50462720,
"dependencyBytes": 26214400,
"packageInstances": 131,
"unexpectedRuntimeRoots": 0,
diff --git a/src/main/ipc/commands.test.ts b/src/main/ipc/commands.test.ts
index e5e54830..33b0d1f4 100644
--- a/src/main/ipc/commands.test.ts
+++ b/src/main/ipc/commands.test.ts
@@ -1,5 +1,13 @@
import { createHash } from 'node:crypto'
-import { access, mkdir, mkdtemp, realpath, rm, symlink } from 'node:fs/promises'
+import {
+ access,
+ mkdir,
+ mkdtemp,
+ realpath,
+ rm,
+ symlink,
+ writeFile,
+} from 'node:fs/promises'
import { tmpdir } from 'node:os'
import path from 'node:path'
import { NOOP_TASK_ACTIVITY_RECORDER } from '@core/activity'
@@ -12,6 +20,7 @@ import { SettingsManager } from '@core/settings/settings-manager'
import { ErrorCode } from '@shared/errors'
import { EXTERNAL_URLS } from '@shared/external-urls'
import { Commands } from '@shared/protocol/commands'
+import { parseProtocolEnvelope } from '@shared/protocol/errors'
import { Events } from '@shared/protocol/events'
import type { AppImageIntegrationView } from '@shared/types/appimage-integration'
import { CliPackageManager } from '@shared/types/cli-tool'
@@ -75,6 +84,7 @@ const fromWebContentsMock = vi.fn()
const ipcHandleMock = vi.fn()
const ipcRemoveHandlerMock = vi.fn()
const openExternalMock = vi.fn()
+const openPathMock = vi.fn()
const showOpenDialogMock = vi.fn()
const showSaveDialogMock = vi.fn()
vi.mock('electron', () => ({
@@ -92,6 +102,7 @@ vi.mock('electron', () => ({
},
shell: {
openExternal: (...args: unknown[]) => openExternalMock(...args),
+ openPath: (...args: unknown[]) => openPathMock(...args),
showItemInFolder: vi.fn(),
},
}))
@@ -1446,6 +1457,61 @@ describe('buildCommandHandlers', () => {
expect(ipcRemoveHandlerMock).toHaveBeenCalledWith(Commands.RestartEngine)
})
+ it.each(['opened', 'missing-app', 'missing-file'])(
+ 'preserves the Open file outcome across IPC: %s',
+ async (outcome) => {
+ ipcHandleMock.mockReset()
+ openPathMock
+ .mockReset()
+ .mockResolvedValue(
+ outcome === 'missing-app' ? 'No application available' : ''
+ )
+ const directory = await mkdtemp(path.join(tmpdir(), 'motrix-open-file-'))
+ const file = path.join(directory, 'completed.txt')
+ const ctx = fakeCtx()
+ const task = makeDownloadTask({
+ id: 'open-file',
+ status: TaskStatus.Completed,
+ fileCount: 1,
+ diskPath: file,
+ finalPath: file,
+ })
+ const dispose = registerCommandHandlers({
+ ...ctx,
+ taskManager: { ...ctx.taskManager, getById: vi.fn(() => task) },
+ } as unknown as CommandContext)
+ try {
+ if (outcome !== 'missing-file') await writeFile(file, 'completed')
+ const registration = ipcHandleMock.mock.calls.find(
+ ([channel]) => channel === Commands.OpenTaskFile
+ )
+ expect(registration).toBeDefined()
+ const result = await registration?.[1]({}, { taskId: task.id })
+ // The wire must preserve the classification without an Error instance.
+ const wire = JSON.parse(JSON.stringify(result))
+ if (outcome === 'opened') {
+ expect(parseProtocolEnvelope(wire)).toBeNull()
+ } else {
+ expect(() => parseProtocolEnvelope(wire)).toThrow(
+ expect.objectContaining({
+ name: 'TransportError',
+ code:
+ outcome === 'missing-app'
+ ? ErrorCode.TaskOpenAppFailed
+ : ErrorCode.TaskOpenFailed,
+ })
+ )
+ }
+ expect(openPathMock).toHaveBeenCalledTimes(
+ outcome === 'missing-file' ? 0 : 1
+ )
+ } finally {
+ dispose()
+ await rm(directory, { recursive: true, force: true })
+ }
+ }
+ )
+
it('keeps an accepted command inside the shutdown drain', async () => {
ipcHandleMock.mockReset()
ipcRemoveHandlerMock.mockReset()
diff --git a/src/main/ipc/commands.ts b/src/main/ipc/commands.ts
index 76f94388..8f3cad7e 100644
--- a/src/main/ipc/commands.ts
+++ b/src/main/ipc/commands.ts
@@ -99,6 +99,10 @@ import nativeMessagingExtensions from '@shared/config/native-messaging-extension
import { AppError, ErrorCode } from '@shared/errors'
import { EXTERNAL_URLS } from '@shared/external-urls'
import { Commands } from '@shared/protocol/commands'
+import {
+ makeProtocolFailure,
+ makeProtocolSuccess,
+} from '@shared/protocol/errors'
import { Events } from '@shared/protocol/events'
import type { CommandHandlerMap } from '@shared/protocol/handler-types'
import { OPERATION_CHANNELS } from '@shared/protocol/operation-channels'
@@ -2005,6 +2009,17 @@ export function registerCommandHandlers(ctx: CommandContext): () => void {
(handler as any)(event.sender, ...args)
).finally(() => leaveModal?.())
})
+ } else if (channel === Commands.OpenTaskFile) {
+ registerTrustedIpcHandler(channel, async (_event, ...args) => {
+ try {
+ await invoke(() => handler(...args))
+ return makeProtocolSuccess(null)
+ } catch (error) {
+ // Electron serializes thrown errors as messages, dropping the code
+ // needed to distinguish filesystem failures from OS app failures.
+ return makeProtocolFailure(error)
+ }
+ })
} else {
registerTrustedIpcHandler(channel, async (_event, ...args) =>
invoke(() => handler(...args))
diff --git a/src/main/ipc/commands/open-task-file.test.ts b/src/main/ipc/commands/open-task-file.test.ts
index 89119ca9..6dce7dcf 100644
--- a/src/main/ipc/commands/open-task-file.test.ts
+++ b/src/main/ipc/commands/open-task-file.test.ts
@@ -6,6 +6,8 @@ import { makeDownloadTask } from '@test-utils/task'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { createOpenTaskFileHandler } from './open-task-file'
+const { warn } = vi.hoisted(() => ({ warn: vi.fn() }))
+vi.mock('@core/logger', () => ({ getLogger: () => ({ warn }) }))
vi.mock('node:fs/promises', () => ({ stat: vi.fn() }))
function setup() {
@@ -27,6 +29,7 @@ function setup() {
}
beforeEach(() => {
+ warn.mockClear()
vi.mocked(stat)
.mockReset()
.mockResolvedValue({ isFile: () => true } as Awaited<
@@ -109,11 +112,57 @@ describe('openTaskFile', () => {
expect(shell.openPath).not.toHaveBeenCalled()
})
- it('reports an operating system open failure', async () => {
+ it('preserves the filesystem failure in the IPC message and logs the published path', async () => {
const { handler, shell } = setup()
- shell.openPath.mockResolvedValueOnce('No application available')
+ const cause = Object.assign(
+ new Error('ENOENT: no such file or directory'),
+ {
+ code: 'ENOENT',
+ }
+ )
+ vi.mocked(stat).mockRejectedValueOnce(cause)
await expect(handler({ taskId: 'a' })).rejects.toMatchObject({
code: ErrorCode.TaskOpenFailed,
+ message:
+ 'Task output could not be opened: ENOENT: no such file or directory',
+ cause,
+ })
+ expect(warn).toHaveBeenCalledExactlyOnceWith(
+ {
+ err: cause,
+ taskId: 'a',
+ outputPath: '/downloads/final.bin',
+ finalPath: '/downloads/final.bin',
+ diskPath: '/downloads/partial.bin',
+ stage: 'stat',
+ },
+ 'task_open_failed'
+ )
+ expect(shell.openPath).not.toHaveBeenCalled()
+ })
+
+ it('classifies an operating system open failure separately from a missing file', async () => {
+ const { handler, shell } = setup()
+ shell.openPath.mockResolvedValueOnce('No application available')
+ await expect(handler({ taskId: 'a' })).rejects.toMatchObject({
+ code: ErrorCode.TaskOpenAppFailed,
+ message: 'Task output could not be opened: No application available',
+ })
+ expect(warn).toHaveBeenCalledExactlyOnceWith(
+ expect.objectContaining({
+ stage: 'open',
+ outputPath: '/downloads/final.bin',
+ }),
+ 'task_open_failed'
+ )
+ })
+
+ it('classifies a rejected OS open request without depending on its language', async () => {
+ const { handler, shell } = setup()
+ shell.openPath.mockRejectedValueOnce(new Error('应用程序已被删除'))
+ await expect(handler({ taskId: 'a' })).rejects.toMatchObject({
+ code: ErrorCode.TaskOpenAppFailed,
+ message: 'Task output could not be opened: 应用程序已被删除',
})
})
diff --git a/src/main/ipc/commands/open-task-file.ts b/src/main/ipc/commands/open-task-file.ts
index 9d151bec..801f7834 100644
--- a/src/main/ipc/commands/open-task-file.ts
+++ b/src/main/ipc/commands/open-task-file.ts
@@ -1,10 +1,13 @@
import { stat } from 'node:fs/promises'
import path from 'node:path'
+import { getLogger } from '@core/logger'
import { AppError, ErrorCode } from '@shared/errors'
import { openTaskFilePayloadSchema } from '@shared/schemas/open-task-file'
import type { DownloadTask } from '@shared/types/task'
import { canOpenTaskFile } from '@shared/types/task-actions'
+const log = getLogger('open-task-file')
+
interface OpenTaskFileDeps {
shell: { openPath: (path: string) => Promise<string> }
getTask: (taskId: string) => DownloadTask | undefined
@@ -34,10 +37,12 @@ export function createOpenTaskFileHandler(deps: OpenTaskFileDeps) {
ErrorCode.IpcInvalidPayload,
'Invalid task output path'
)
+ let stage: 'stat' | 'recheck' | 'open' = 'stat'
try {
if (!(await stat(outputPath)).isFile())
throw new Error('Task output is not a file')
// Check again after the filesystem read in case the task was removed.
+ stage = 'recheck'
const current = deps.getTask(task.id)
if (
!current ||
@@ -45,12 +50,27 @@ export function createOpenTaskFileHandler(deps: OpenTaskFileDeps) {
(current.finalPath || current.diskPath) !== outputPath
)
throw new Error('Task output changed')
+ stage = 'open'
const error = await deps.shell.openPath(outputPath)
if (error) throw new Error(error)
} catch (cause) {
+ log.warn(
+ {
+ err: cause,
+ taskId: task.id,
+ outputPath,
+ finalPath: task.finalPath,
+ diskPath: task.diskPath,
+ stage,
+ },
+ 'task_open_failed'
+ )
+ const detail = cause instanceof Error ? cause.message : String(cause)
throw new AppError(
- ErrorCode.TaskOpenFailed,
- 'Task output could not be opened',
+ stage === 'open'
+ ? ErrorCode.TaskOpenAppFailed
+ : ErrorCode.TaskOpenFailed,
+ `Task output could not be opened: ${detail}`,
cause
)
}
diff --git a/src/renderer/lib/open-task-file.test.ts b/src/renderer/lib/open-task-file.test.ts
new file mode 100644
index 00000000..304d66dd
--- /dev/null
+++ b/src/renderer/lib/open-task-file.test.ts
@@ -0,0 +1,73 @@
+import { toast } from '@renderer/components/ui/toast'
+import { ErrorCode } from '@shared/errors'
+import { Commands } from '@shared/protocol/commands'
+import { TransportError } from '@shared/protocol/errors'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { i18n } from './i18n'
+import { openTaskFile } from './open-task-file'
+import { transport } from './transport'
+
+vi.mock('@renderer/components/ui/toast', () => ({ toast: { add: vi.fn() } }))
+vi.mock('./transport', () => ({ transport: { invoke: vi.fn() } }))
+
+beforeEach(() => vi.resetAllMocks())
+
+describe('openTaskFile', () => {
+ it('opens by task ID without showing an error on success', async () => {
+ vi.mocked(transport.invoke).mockResolvedValueOnce(null)
+ await openTaskFile('task-1', i18n.getFixedT('en-US'))
+ expect(transport.invoke).toHaveBeenCalledExactlyOnceWith(
+ Commands.OpenTaskFile,
+ { taskId: 'task-1' }
+ )
+ expect(toast.add).not.toHaveBeenCalled()
+ })
+
+ it.each([
+ [
+ 'en-US',
+ 'Could not open file',
+ 'The system could not open this file. Check that its default app is still installed, or use Open folder to choose another app.',
+ ],
+ [
+ 'zh-CN',
+ '无法打开文件',
+ '系统无法打开此文件。请检查默认应用是否仍已安装,或通过“打开文件夹”选择其他应用打开。',
+ ],
+ ])(
+ 'explains OS open failures in %s without displaying IPC internals',
+ async (locale, title, description) => {
+ vi.mocked(transport.invoke).mockRejectedValueOnce(
+ new TransportError(
+ ErrorCode.TaskOpenAppFailed,
+ 'The application is missing (-10814)'
+ )
+ )
+ await openTaskFile('task-1', i18n.getFixedT(locale))
+ expect(toast.add).toHaveBeenCalledExactlyOnceWith({
+ title,
+ description,
+ type: 'error',
+ })
+ }
+ )
+
+ it.each([
+ new TransportError(ErrorCode.TaskOpenFailed, 'ENOENT'),
+ new Error(
+ "Error invoking remote method 'command:openTaskFile': AppError: Task output could not be opened"
+ ),
+ ])(
+ 'does not misidentify other failures as app association failures: %s',
+ async (error) => {
+ vi.mocked(transport.invoke).mockRejectedValueOnce(error)
+ await openTaskFile('task-1', i18n.getFixedT('en-US'))
+ expect(toast.add).toHaveBeenCalledExactlyOnceWith({
+ title: 'Could not open file',
+ description:
+ 'Check that the file still exists and you have permission to open it.',
+ type: 'error',
+ })
+ }
+ )
+})
diff --git a/src/renderer/lib/open-task-file.ts b/src/renderer/lib/open-task-file.ts
new file mode 100644
index 00000000..f441712a
--- /dev/null
+++ b/src/renderer/lib/open-task-file.ts
@@ -0,0 +1,27 @@
+import { toast } from '@renderer/components/ui/toast'
+import { ErrorCode } from '@shared/errors'
+import { Commands } from '@shared/protocol/commands'
+import { TransportError } from '@shared/protocol/errors'
+import type { TFunction } from 'i18next'
+import { transport } from './transport'
+
+/** Shared failure presentation for the context menu and task inspector. */
+export async function openTaskFile(
+ taskId: string,
+ t: TFunction
+): Promise<void> {
+ try {
+ await transport.invoke(Commands.OpenTaskFile, { taskId })
+ } catch (error) {
+ toast.add({
+ title: t('panel.downloads.action.openFileFailed'),
+ description: t(
+ error instanceof TransportError &&
+ error.code === ErrorCode.TaskOpenAppFailed
+ ? 'panel.downloads.action.openFileAppFailed'
+ : 'panel.downloads.action.openFileFailedHint'
+ ),
+ type: 'error',
+ })
+ }
+}
diff --git a/src/renderer/lib/transport/electron.test.ts b/src/renderer/lib/transport/electron.test.ts
index 02335058..953b9303 100644
--- a/src/renderer/lib/transport/electron.test.ts
+++ b/src/renderer/lib/transport/electron.test.ts
@@ -15,43 +15,50 @@ afterEach(() => {
})
describe('ElectronTransport', () => {
- it('unwraps a protocol success envelope', async () => {
- const invoke = vi.fn(async () => makeProtocolSuccess({ revision: 3 }))
- Object.defineProperty(window, 'motrix', {
- configurable: true,
- value: { invoke, on: vi.fn(), off: vi.fn(), platform: 'darwin' },
- })
-
- await expect(
- new ElectronTransport().invoke(Queries.GetTaskInspectorActivity, {
- taskId: 'task-1',
+ it.each([Queries.GetTaskInspectorActivity, Commands.OpenTaskFile])(
+ 'unwraps a protocol success envelope for %s',
+ async (channel) => {
+ const invoke = vi.fn(async () => makeProtocolSuccess({ revision: 3 }))
+ Object.defineProperty(window, 'motrix', {
+ configurable: true,
+ value: { invoke, on: vi.fn(), off: vi.fn(), platform: 'darwin' },
})
- ).resolves.toEqual({ revision: 3 })
- })
- it('reconstructs the typed domain failure', async () => {
- const invoke = vi.fn(async () =>
- makeProtocolFailure({
- code: ErrorCode.TaskNotFound,
- message: 'task missing',
- })
- )
- Object.defineProperty(window, 'motrix', {
- configurable: true,
- value: { invoke, on: vi.fn(), off: vi.fn(), platform: 'darwin' },
- })
+ await expect(
+ new ElectronTransport().invoke(channel, {
+ taskId: 'task-1',
+ })
+ ).resolves.toEqual({ revision: 3 })
+ }
+ )
- await expect(
- new ElectronTransport().invoke(Queries.GetTaskInspectorActivity, {
- taskId: 'task-1',
- })
- ).rejects.toEqual(
- expect.objectContaining<Partial<TransportError>>({
- name: 'TransportError',
- code: ErrorCode.TaskNotFound,
+ it.each([Queries.GetTaskInspectorActivity, Commands.OpenTaskFile])(
+ 'reconstructs the typed domain failure for %s',
+ async (channel) => {
+ const invoke = vi.fn(async () =>
+ makeProtocolFailure({
+ code: ErrorCode.TaskOpenAppFailed,
+ message: 'No application available',
+ })
+ )
+ Object.defineProperty(window, 'motrix', {
+ configurable: true,
+ value: { invoke, on: vi.fn(), off: vi.fn(), platform: 'darwin' },
})
- )
- })
+
+ await expect(
+ new ElectronTransport().invoke(channel, {
+ taskId: 'task-1',
+ })
+ ).rejects.toEqual(
+ expect.objectContaining<Partial<TransportError>>({
+ name: 'TransportError',
+ code: ErrorCode.TaskOpenAppFailed,
+ message: 'No application available',
+ })
+ )
+ }
+ )
it('preserves non-envelope command results', async () => {
const invoke = vi.fn(async () => ({ ok: true }))
@@ -65,17 +72,20 @@ describe('ElectronTransport', () => {
).resolves.toEqual({ ok: true })
})
- it('rejects a malformed inspector envelope', async () => {
- const invoke = vi.fn(async () => ({ ok: true, revision: 3 }))
- Object.defineProperty(window, 'motrix', {
- configurable: true,
- value: { invoke, on: vi.fn(), off: vi.fn(), platform: 'darwin' },
- })
-
- await expect(
- new ElectronTransport().invoke(Queries.GetTaskInspectorActivity, {
- taskId: 'task-1',
+ it.each([Queries.GetTaskInspectorActivity, Commands.OpenTaskFile])(
+ 'rejects a malformed envelope for %s',
+ async (channel) => {
+ const invoke = vi.fn(async () => ({ ok: true, revision: 3 }))
+ Object.defineProperty(window, 'motrix', {
+ configurable: true,
+ value: { invoke, on: vi.fn(), off: vi.fn(), platform: 'darwin' },
})
- ).rejects.toBeInstanceOf(ProtocolEnvelopeError)
- })
+
+ await expect(
+ new ElectronTransport().invoke(channel, {
+ taskId: 'task-1',
+ })
+ ).rejects.toBeInstanceOf(ProtocolEnvelopeError)
+ }
+ )
})
diff --git a/src/renderer/lib/transport/electron.ts b/src/renderer/lib/transport/electron.ts
index e4421ee4..ead01194 100644
--- a/src/renderer/lib/transport/electron.ts
+++ b/src/renderer/lib/transport/electron.ts
@@ -35,7 +35,8 @@ export class ElectronTransport implements Transport {
})
}
const value = await getMotrix().invoke(channel, ...args)
- return channel === Queries.GetTaskInspectorActivity
+ return channel === Queries.GetTaskInspectorActivity ||
+ channel === Commands.OpenTaskFile
? parseProtocolEnvelope(value)
: value
}
diff --git a/src/renderer/routes/downloads/inspector/task-inspector-action-bar.test.tsx b/src/renderer/routes/downloads/inspector/task-inspector-action-bar.test.tsx
index 83ef9010..3af7c50d 100644
--- a/src/renderer/routes/downloads/inspector/task-inspector-action-bar.test.tsx
+++ b/src/renderer/routes/downloads/inspector/task-inspector-action-bar.test.tsx
@@ -37,7 +37,9 @@ vi.mock('@renderer/components/ui/toast', () => ({
import '@renderer/lib/i18n'
import { transport } from '@renderer/lib/transport'
+import { ErrorCode } from '@shared/errors'
import { Commands } from '@shared/protocol/commands'
+import { TransportError } from '@shared/protocol/errors'
import { Queries } from '@shared/protocol/queries'
import { TaskInspectorActionBar } from './task-inspector-action-bar'
@@ -86,12 +88,15 @@ describe('TaskInspectorActionBar', () => {
taskId: 't1',
})
expect(button).toHaveProperty('disabled', true)
- reject(new Error('File no longer exists'))
+ reject(
+ new TransportError(ErrorCode.TaskOpenAppFailed, 'Application removed')
+ )
await waitFor(() =>
expect(toastAddMock).toHaveBeenCalledWith(
expect.objectContaining({
title: 'Could not open file',
- description: 'File no longer exists',
+ description:
+ 'The system could not open this file. Check that its default app is still installed, or use Open folder to choose another app.',
type: 'error',
})
)
diff --git a/src/renderer/routes/downloads/inspector/task-inspector-action-bar.tsx b/src/renderer/routes/downloads/inspector/task-inspector-action-bar.tsx
index 220501a5..41279fa7 100644
--- a/src/renderer/routes/downloads/inspector/task-inspector-action-bar.tsx
+++ b/src/renderer/routes/downloads/inspector/task-inspector-action-bar.tsx
@@ -15,6 +15,7 @@ import { MagnetFileSelectionButton } from '@renderer/components/task/magnet-file
import { Button } from '@renderer/components/ui/button'
import { toast } from '@renderer/components/ui/toast'
import { useModifierKeys } from '@renderer/hooks/use-modifier-keys'
+import { openTaskFile } from '@renderer/lib/open-task-file'
import { rtlMirror } from '@renderer/lib/task-status-ui'
import { transport } from '@renderer/lib/transport'
import { cn } from '@renderer/lib/utils'
@@ -103,13 +104,7 @@ function OpenTaskFileButton({ task }: { task: DownloadTask }) {
if (opening) return
setOpening(true)
try {
- await transport.invoke(Commands.OpenTaskFile, { taskId: task.id })
- } catch (error) {
- toast.add({
- title: t('panel.downloads.action.openFileFailed'),
- description: error instanceof Error ? error.message : String(error),
- type: 'error',
- })
+ await openTaskFile(task.id, t)
} finally {
setOpening(false)
}
diff --git a/src/renderer/routes/downloads/task-actions-menu.test.tsx b/src/renderer/routes/downloads/task-actions-menu.test.tsx
index 9facf175..0c69e0c5 100644
--- a/src/renderer/routes/downloads/task-actions-menu.test.tsx
+++ b/src/renderer/routes/downloads/task-actions-menu.test.tsx
@@ -1,4 +1,6 @@
import { Toolbar as ToolbarPrimitive } from '@base-ui/react/toolbar'
+import { RedownloadOverwriteDialogHost } from '@renderer/routes/downloads/inspector/redownload-overwrite-dialog-host'
+import { useRedownloadOverwriteStore } from '@renderer/routes/downloads/inspector/redownload-overwrite-store'
import { RemoveTasksDialogHost } from '@renderer/routes/downloads/inspector/remove-tasks-dialog-host'
import { useRemoveTasksStore } from '@renderer/routes/downloads/inspector/remove-tasks-store'
import { render as renderBase } from '@testing-library/react'
@@ -12,12 +14,14 @@ import { openAddTaskDialog } from '@renderer/lib/open-add-task-dialog'
import { openMagnetFileSelection } from '@renderer/lib/open-magnet-file-selection'
import { transport } from '@renderer/lib/transport'
import { CommandIds } from '@shared/commands-catalog'
-import { DownloadErrorCode } from '@shared/errors'
+import { DownloadErrorCode, ErrorCode } from '@shared/errors'
import { Commands } from '@shared/protocol/commands'
+import { TransportError } from '@shared/protocol/errors'
+import { Queries } from '@shared/protocol/queries'
import type { DownloadTask } from '@shared/types/task'
import { TaskStatus, TaskType } from '@shared/types/task'
import { makeDownloadTask } from '@test-utils/task'
-import { act, fireEvent, screen, waitFor } from '@testing-library/react'
+import { act, fireEvent, screen, waitFor, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { TaskActionsMenu } from './task-actions-menu'
@@ -27,13 +31,19 @@ function render(element: ReactElement) {
return renderBase(
<>
<RemoveTasksDialogHost />
+ <RedownloadOverwriteDialogHost />
{element}
</>
)
}
-beforeEach(() =>
+beforeEach(() => {
useRemoveTasksStore.setState({ open: false, targets: [], busy: false })
-)
+ useRedownloadOverwriteStore.setState({
+ open: false,
+ target: null,
+ busy: false,
+ })
+})
vi.mock('@renderer/features/plugin-operations/operation-task-menu', () => ({
OperationTaskMenuItems: () => null,
@@ -106,6 +116,95 @@ function setup(context = true, items = tasks) {
}
describe('TaskActionsMenu', () => {
+ it.each([true, false])(
+ 're-downloads the selected completed task after confirmation (context menu: %s)',
+ async (context) => {
+ const task = makeDownloadTask({
+ id: 'completed',
+ name: 'Completed.bin',
+ status: TaskStatus.Completed,
+ uris: ['https://example.test/Completed.bin'],
+ saveDir: '/downloads',
+ finalName: 'Completed.bin',
+ finalPath: '/downloads/Completed.bin',
+ })
+ setup(context, [task])
+ vi.mocked(transport.invoke)
+ .mockResolvedValueOnce({ exists: true })
+ .mockResolvedValueOnce(null)
+ .mockResolvedValueOnce({ ok: true })
+ if (context) fireEvent.contextMenu(screen.getByText(task.name))
+ else await userEvent.click(screen.getByRole('button', { name: 'More' }))
+ fireEvent.click(
+ await screen.findByRole('menuitem', {
+ name: 'Re-download',
+ })
+ )
+ const dialog = await screen.findByRole('alertdialog', {
+ name: 'File Already Exists',
+ })
+ expect(dialog).toHaveTextContent(task.name)
+ expect(transport.invoke).toHaveBeenCalledExactlyOnceWith(
+ Queries.CheckTaskFileExists,
+ { taskId: task.id }
+ )
+ fireEvent.click(
+ within(dialog).getByRole('button', { name: 'Re-download' })
+ )
+ await waitFor(() =>
+ expect(transport.invoke).toHaveBeenCalledWith(
+ Commands.CreateTask,
+ expect.objectContaining({
+ uris: task.uris,
+ saveDir: task.saveDir,
+ filename: task.finalName,
+ })
+ )
+ )
+ await waitFor(() =>
+ expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument()
+ )
+ }
+ )
+
+ it.each([true, false])(
+ 'offers editing before re-download on Alt-click (context menu: %s)',
+ async (context) => {
+ const task = makeDownloadTask({
+ id: 'completed',
+ name: 'Completed.bin',
+ status: TaskStatus.Completed,
+ uris: ['https://example.test/Completed.bin'],
+ saveDir: '/downloads',
+ finalName: 'Completed.bin',
+ })
+ setup(context, [task])
+ vi.mocked(transport.invoke).mockResolvedValueOnce(null)
+ if (context) fireEvent.contextMenu(screen.getByText(task.name))
+ else await userEvent.click(screen.getByRole('button', { name: 'More' }))
+ fireEvent.click(
+ await screen.findByRole('menuitem', {
+ name: 'Re-download',
+ }),
+ { altKey: true }
+ )
+ await waitFor(() =>
+ expect(openAddTaskDialog).toHaveBeenCalledWith(
+ expect.objectContaining({
+ urls: task.uris[0],
+ saveDir: task.saveDir,
+ filename: task.finalName,
+ })
+ )
+ )
+ expect(transport.invoke).not.toHaveBeenCalledWith(
+ Commands.CreateTask,
+ expect.anything()
+ )
+ expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument()
+ }
+ )
+
it('disables the inspector menu and shortcut without changing the saved intent when selection is empty', async () => {
const selection = setup(false)
act(() => {
@@ -428,7 +527,9 @@ describe('TaskActionsMenu', () => {
finalPath: '/downloads/a.bin',
}),
])
- vi.mocked(transport.invoke).mockRejectedValueOnce(new Error('File missing'))
+ vi.mocked(transport.invoke).mockRejectedValueOnce(
+ new TransportError(ErrorCode.TaskOpenAppFailed, 'Application removed')
+ )
fireEvent.contextMenu(screen.getByText('a'))
fireEvent.click(await screen.findByRole('menuitem', { name: 'Open file' }))
await waitFor(() =>
@@ -438,7 +539,12 @@ describe('TaskActionsMenu', () => {
)
await waitFor(() =>
expect(toast.add).toHaveBeenCalledWith(
- expect.objectContaining({ title: 'Could not open file', type: 'error' })
+ expect.objectContaining({
+ title: 'Could not open file',
+ description:
+ 'The system could not open this file. Check that its default app is still installed, or use Open folder to choose another app.',
+ type: 'error',
+ })
)
)
})
diff --git a/src/renderer/routes/downloads/task-actions-menu.tsx b/src/renderer/routes/downloads/task-actions-menu.tsx
index 12ab45bc..68bde00c 100644
--- a/src/renderer/routes/downloads/task-actions-menu.tsx
+++ b/src/renderer/routes/downloads/task-actions-menu.tsx
@@ -25,6 +25,7 @@ import {
import { OperationTaskMenuItems } from '@renderer/features/plugin-operations/operation-task-menu'
import { openAddTaskDialog } from '@renderer/lib/open-add-task-dialog'
import { openMagnetFileSelection } from '@renderer/lib/open-magnet-file-selection'
+import { openTaskFile } from '@renderer/lib/open-task-file'
import { transport } from '@renderer/lib/transport'
import { CommandIds } from '@shared/commands-catalog'
import { Commands } from '@shared/protocol/commands'
@@ -264,10 +265,7 @@ export function TaskActionsMenu({
disabled={pending}
onClick={() =>
void runAction(
- () =>
- transport.invoke(Commands.OpenTaskFile, {
- taskId: single.id,
- }),
+ () => openTaskFile(single.id, t),
t('panel.downloads.action.openFileFailed')
)
}
diff --git a/src/shared/errors.ts b/src/shared/errors.ts
index 0f66edd3..0086ae76 100644
--- a/src/shared/errors.ts
+++ b/src/shared/errors.ts
@@ -10,6 +10,7 @@ export enum ErrorCode {
TaskNotFound = 'TASK_NOT_FOUND',
TaskRevealFailed = 'TASK_REVEAL_FAILED',
TaskOpenFailed = 'TASK_OPEN_FAILED',
+ TaskOpenAppFailed = 'TASK_OPEN_APP_FAILED',
TaskNotRetryable = 'TASK_NOT_RETRYABLE',
TaskPathTooLong = 'TASK_PATH_TOO_LONG',
SessionRestoreFailed = 'SESSION_RESTORE_FAILED',
diff --git a/src/shared/locales/ar.json b/src/shared/locales/ar.json
index 780b4444..1beaf990 100644
--- a/src/shared/locales/ar.json
+++ b/src/shared/locales/ar.json
@@ -859,6 +859,8 @@
"moveQueueUp": "نقل لأعلى في قائمة الانتظار",
"openFile": "فتح الملف",
"openFileFailed": "تعذّر فتح الملف",
+ "openFileAppFailed": "تعذّر على النظام فتح هذا الملف. تأكد من أن التطبيق الافتراضي لا يزال مثبّتًا، أو استخدم فتح المجلد لاختيار تطبيق آخر.",
+ "openFileFailedHint": "تأكد من أن الملف لا يزال موجودًا وأن لديك إذنًا بفتحه.",
"openFolder": "فتح المجلد",
"pause": "إيقاف مؤقت",
"pauseTooltipBatch": "إيقاف مؤقت: {{n}} من المهام المحددة ({{total}})",
diff --git a/src/shared/locales/bg.json b/src/shared/locales/bg.json
index 12433293..83564f24 100644
--- a/src/shared/locales/bg.json
+++ b/src/shared/locales/bg.json
@@ -847,6 +847,8 @@
"moveQueueUp": "Преместване нагоре в опашката",
"openFile": "Отваряне на файла",
"openFileFailed": "Файлът не можа да бъде отворен",
+ "openFileAppFailed": "Системата не можа да отвори този файл. Проверете дали приложението по подразбиране все още е инсталирано или отворете папката, за да изберете друго приложение.",
+ "openFileFailedHint": "Проверете дали файлът все още съществува и дали имате разрешение да го отворите.",
"openFolder": "Отваряне на папката",
"pause": "Пауза",
"pauseTooltipBatch": "Пауза на {{n}} от {{total}} избрани задачи",
diff --git a/src/shared/locales/ca.json b/src/shared/locales/ca.json
index 84e10efe..a7838e93 100644
--- a/src/shared/locales/ca.json
+++ b/src/shared/locales/ca.json
@@ -850,6 +850,8 @@
"moveQueueUp": "Moure amunt a la cua",
"openFile": "Obrir el fitxer",
"openFileFailed": "No s'ha pogut obrir el fitxer",
+ "openFileAppFailed": "El sistema no ha pogut obrir aquest fitxer. Comproveu que l’aplicació predeterminada encara estigui instal·lada o obriu la carpeta per triar una altra aplicació.",
+ "openFileFailedHint": "Comproveu que el fitxer encara existeixi i que tingueu permís per obrir-lo.",
"openFolder": "Obrir la carpeta",
"pause": "Pausar",
"pauseTooltipBatch": "Pausar {{n}} de {{total}} tasques seleccionades",
diff --git a/src/shared/locales/de.json b/src/shared/locales/de.json
index 51ff787c..26d33bb0 100644
--- a/src/shared/locales/de.json
+++ b/src/shared/locales/de.json
@@ -903,6 +903,8 @@
"removeMixedTitle": "{{count}} Aufgaben entfernen?",
"openFile": "Datei öffnen",
"openFileFailed": "Die Datei konnte nicht geöffnet werden",
+ "openFileAppFailed": "Das System konnte diese Datei nicht öffnen. Prüfe, ob die Standard-App noch installiert ist, oder öffne den Ordner, um eine andere App auszuwählen.",
+ "openFileFailedHint": "Prüfe, ob die Datei noch vorhanden ist und du sie öffnen darfst.",
"chooseFiles": "Dateien auswählen…",
"queueOrder": "Download-Reihenfolge",
"moveQueueTop": "An den Anfang",
diff --git a/src/shared/locales/el.json b/src/shared/locales/el.json
index 16202be6..ea8b1344 100644
--- a/src/shared/locales/el.json
+++ b/src/shared/locales/el.json
@@ -847,6 +847,8 @@
"moveQueueUp": "Μετακίνηση προς τα πάνω στην ουρά",
"openFile": "Άνοιγμα αρχείου",
"openFileFailed": "Δεν ήταν δυνατό το άνοιγμα του αρχείου",
+ "openFileAppFailed": "Το σύστημα δεν μπόρεσε να ανοίξει αυτό το αρχείο. Ελέγξτε αν η προεπιλεγμένη εφαρμογή είναι ακόμη εγκατεστημένη ή ανοίξτε τον φάκελο για να επιλέξετε άλλη εφαρμογή.",
+ "openFileFailedHint": "Βεβαιωθείτε ότι το αρχείο υπάρχει ακόμη και ότι έχετε δικαίωμα να το ανοίξετε.",
"openFolder": "Άνοιγμα φακέλου",
"pause": "Παύση",
"pauseTooltipBatch": "Παύση — επιλεγμένες εργασίες: {{n}} / {{total}}",
diff --git a/src/shared/locales/en-US.json b/src/shared/locales/en-US.json
index 77e21a74..78398471 100644
--- a/src/shared/locales/en-US.json
+++ b/src/shared/locales/en-US.json
@@ -903,6 +903,8 @@
"removeMixedTitle": "Remove {{count}} tasks?",
"openFile": "Open file",
"openFileFailed": "Could not open file",
+ "openFileAppFailed": "The system could not open this file. Check that its default app is still installed, or use Open folder to choose another app.",
+ "openFileFailedHint": "Check that the file still exists and you have permission to open it.",
"chooseFiles": "Choose files…",
"queueOrder": "Download order",
"moveQueueTop": "Move to Front",
diff --git a/src/shared/locales/es.json b/src/shared/locales/es.json
index 0c529eb4..5e9647f0 100644
--- a/src/shared/locales/es.json
+++ b/src/shared/locales/es.json
@@ -915,6 +915,8 @@
"removeMixedTitle": "¿Quitar las tareas ({{count}})?",
"openFile": "Abrir archivo",
"openFileFailed": "No se pudo abrir el archivo",
+ "openFileAppFailed": "El sistema no pudo abrir este archivo. Comprueba que la aplicación predeterminada siga instalada o abre la carpeta para elegir otra aplicación.",
+ "openFileFailedHint": "Comprueba que el archivo siga existiendo y que tengas permiso para abrirlo.",
"chooseFiles": "Elegir archivos…",
"queueOrder": "Orden de descarga",
"moveQueueTop": "Mover al principio",
diff --git a/src/shared/locales/fa.json b/src/shared/locales/fa.json
index d12c9cfe..be412340 100644
--- a/src/shared/locales/fa.json
+++ b/src/shared/locales/fa.json
@@ -847,6 +847,8 @@
"moveQueueUp": "بالاتر بردن در صف",
"openFile": "باز کردن فایل",
"openFileFailed": "باز کردن فایل ممکن نشد",
+ "openFileAppFailed": "سیستم نتوانست این فایل را باز کند. بررسی کنید که برنامهٔ پیش‌فرض همچنان نصب باشد، یا پوشه را باز کنید و برنامهٔ دیگری را انتخاب کنید.",
+ "openFileFailedHint": "بررسی کنید که فایل همچنان وجود داشته باشد و اجازهٔ باز کردن آن را داشته باشید.",
"openFolder": "باز کردن پوشه",
"pause": "مکث",
"pauseTooltipBatch": "مکث {{n}} مورد از {{total}} مورد انتخاب‌شده",
diff --git a/src/shared/locales/fr.json b/src/shared/locales/fr.json
index 579607e6..ac2e523c 100644
--- a/src/shared/locales/fr.json
+++ b/src/shared/locales/fr.json
@@ -850,6 +850,8 @@
"moveQueueUp": "Monter dans la file",
"openFile": "Ouvrir le fichier",
"openFileFailed": "Impossible d’ouvrir le fichier",
+ "openFileAppFailed": "Le système n’a pas pu ouvrir ce fichier. Vérifiez que l’application par défaut est toujours installée ou ouvrez le dossier pour choisir une autre application.",
+ "openFileFailedHint": "Vérifiez que le fichier existe toujours et que vous avez l’autorisation de l’ouvrir.",
"openFolder": "Ouvrir le dossier",
"pause": "Mettre en pause",
"pauseTooltipBatch": "Mettre en pause {{n}} des {{total}} tâches sélectionnées",
diff --git a/src/shared/locales/hu.json b/src/shared/locales/hu.json
index e39f9670..b458d944 100644
--- a/src/shared/locales/hu.json
+++ b/src/shared/locales/hu.json
@@ -903,6 +903,8 @@
"removeMixedTitle": "Eltávolítod a(z) {{count}} feladatot?",
"openFile": "Fájl megnyitása",
"openFileFailed": "Nem sikerült megnyitni a fájlt",
+ "openFileAppFailed": "A rendszer nem tudta megnyitni ezt a fájlt. Ellenőrizze, hogy az alapértelmezett alkalmazás még telepítve van-e, vagy nyissa meg a mappát, és válasszon másik alkalmazást.",
+ "openFileFailedHint": "Ellenőrizze, hogy a fájl még létezik-e, és van-e jogosultsága megnyitni.",
"chooseFiles": "Fájlok kiválasztása…",
"queueOrder": "Letöltési sorrend",
"moveQueueTop": "A sor elejére",
diff --git a/src/shared/locales/id.json b/src/shared/locales/id.json
index 55b509b9..88dbf315 100644
--- a/src/shared/locales/id.json
+++ b/src/shared/locales/id.json
@@ -891,6 +891,8 @@
"removeMixedTitle": "Hapus {{count}} tugas dari daftar?",
"openFile": "Buka berkas",
"openFileFailed": "Berkas tidak dapat dibuka",
+ "openFileAppFailed": "Sistem tidak dapat membuka berkas ini. Pastikan aplikasi default masih terpasang, atau buka folder untuk memilih aplikasi lain.",
+ "openFileFailedHint": "Pastikan berkas masih ada dan Anda memiliki izin untuk membukanya.",
"chooseFiles": "Pilih berkas…",
"queueOrder": "Urutan unduhan",
"moveQueueTop": "Pindahkan ke depan",
diff --git a/src/shared/locales/it.json b/src/shared/locales/it.json
index de86d093..6826b82b 100644
--- a/src/shared/locales/it.json
+++ b/src/shared/locales/it.json
@@ -915,6 +915,8 @@
"removeMixedTitle": "Rimuovere {{count}} attività dall’elenco?",
"openFile": "Apri file",
"openFileFailed": "Impossibile aprire il file",
+ "openFileAppFailed": "Il sistema non ha potuto aprire questo file. Verifica che l’app predefinita sia ancora installata oppure apri la cartella per scegliere un’altra app.",
+ "openFileFailedHint": "Verifica che il file esista ancora e che tu abbia il permesso di aprirlo.",
"chooseFiles": "Scegli file…",
"queueOrder": "Ordine di download",
"moveQueueTop": "Sposta all’inizio",
diff --git a/src/shared/locales/ja.json b/src/shared/locales/ja.json
index 7f361d73..80d6ade5 100644
--- a/src/shared/locales/ja.json
+++ b/src/shared/locales/ja.json
@@ -891,6 +891,8 @@
"removeMixedTitle": "タスク {{count}} 件を削除しますか?",
"openFile": "ファイルを開く",
"openFileFailed": "ファイルを開けませんでした",
+ "openFileAppFailed": "システムでこのファイルを開けませんでした。既定のアプリがまだインストールされているか確認するか、フォルダーを開いて別のアプリを選んでください。",
+ "openFileFailedHint": "ファイルが存在し、開く権限があることを確認してください。",
"chooseFiles": "ファイルを選択…",
"queueOrder": "ダウンロード順序",
"moveQueueTop": "先頭に移動",
diff --git a/src/shared/locales/ko.json b/src/shared/locales/ko.json
index 27de077f..fab42402 100644
--- a/src/shared/locales/ko.json
+++ b/src/shared/locales/ko.json
@@ -891,6 +891,8 @@
"removeMixedTitle": "작업 {{count}}개를 제거하시겠습니까?",
"openFile": "파일 열기",
"openFileFailed": "파일을 열지 못했습니다",
+ "openFileAppFailed": "시스템에서 이 파일을 열 수 없습니다. 기본 앱이 여전히 설치되어 있는지 확인하거나 폴더를 열어 다른 앱을 선택하세요.",
+ "openFileFailedHint": "파일이 여전히 존재하고 파일을 열 권한이 있는지 확인하세요.",
"chooseFiles": "파일 선택…",
"queueOrder": "다운로드 순서",
"moveQueueTop": "맨 앞으로 이동",
diff --git a/src/shared/locales/nb.json b/src/shared/locales/nb.json
index 373be66b..ba963c52 100644
--- a/src/shared/locales/nb.json
+++ b/src/shared/locales/nb.json
@@ -847,6 +847,8 @@
"moveQueueUp": "Flytt opp i køen",
"openFile": "Åpne fil",
"openFileFailed": "Kunne ikke åpne filen",
+ "openFileAppFailed": "Systemet kunne ikke åpne denne filen. Kontroller at standardappen fortsatt er installert, eller åpne mappen for å velge en annen app.",
+ "openFileFailedHint": "Kontroller at filen fortsatt finnes, og at du har tillatelse til å åpne den.",
"openFolder": "Åpne mappe",
"pause": "Sett på pause",
"pauseTooltipBatch": "Sett på pause: {{n}} / {{total}} i utvalget",
diff --git a/src/shared/locales/nl.json b/src/shared/locales/nl.json
index 93f5c540..dd3d7013 100644
--- a/src/shared/locales/nl.json
+++ b/src/shared/locales/nl.json
@@ -847,6 +847,8 @@
"moveQueueUp": "Omhoog in wachtrij",
"openFile": "Bestand openen",
"openFileFailed": "Het bestand kon niet worden geopend",
+ "openFileAppFailed": "Het systeem kon dit bestand niet openen. Controleer of de standaardapp nog is geïnstalleerd of open de map om een andere app te kiezen.",
+ "openFileFailedHint": "Controleer of het bestand nog bestaat en of je toestemming hebt om het te openen.",
"openFolder": "Map openen",
"pause": "Pauzeren",
"pauseTooltipBatch": "{{n}} van de {{total}} geselecteerde taken pauzeren",
diff --git a/src/shared/locales/pl.json b/src/shared/locales/pl.json
index 8a64147a..4c51edb0 100644
--- a/src/shared/locales/pl.json
+++ b/src/shared/locales/pl.json
@@ -927,6 +927,8 @@
"removeMixedTitle": "Usunąć zadania z listy ({{count}})?",
"openFile": "Otwórz plik",
"openFileFailed": "Nie udało się otworzyć pliku",
+ "openFileAppFailed": "System nie mógł otworzyć tego pliku. Sprawdź, czy domyślna aplikacja jest nadal zainstalowana, lub otwórz folder, aby wybrać inną aplikację.",
+ "openFileFailedHint": "Sprawdź, czy plik nadal istnieje i czy masz uprawnienia do jego otwarcia.",
"chooseFiles": "Wybierz pliki…",
"queueOrder": "Kolejność pobierania",
"moveQueueTop": "Przesuń na początek",
diff --git a/src/shared/locales/pt-BR.json b/src/shared/locales/pt-BR.json
index 1a41b9d2..e7ad7e63 100644
--- a/src/shared/locales/pt-BR.json
+++ b/src/shared/locales/pt-BR.json
@@ -915,6 +915,8 @@
"removeMixedTitle": "Remover {{count}} tarefas?",
"openFile": "Abrir arquivo",
"openFileFailed": "Não foi possível abrir o arquivo",
+ "openFileAppFailed": "O sistema não conseguiu abrir este arquivo. Verifique se o aplicativo padrão ainda está instalado ou abra a pasta para escolher outro aplicativo.",
+ "openFileFailedHint": "Verifique se o arquivo ainda existe e se você tem permissão para abri-lo.",
"chooseFiles": "Escolher arquivos…",
"queueOrder": "Ordem dos downloads",
"moveQueueTop": "Mover para o início",
diff --git a/src/shared/locales/ro.json b/src/shared/locales/ro.json
index 68ec70e3..c01493f6 100644
--- a/src/shared/locales/ro.json
+++ b/src/shared/locales/ro.json
@@ -850,6 +850,8 @@
"moveQueueUp": "Mută în sus în coadă",
"openFile": "Deschide fișierul",
"openFileFailed": "Fișierul nu a putut fi deschis",
+ "openFileAppFailed": "Sistemul nu a putut deschide acest fișier. Verifică dacă aplicația implicită este încă instalată sau deschide dosarul pentru a alege altă aplicație.",
+ "openFileFailedHint": "Verifică dacă fișierul mai există și dacă ai permisiunea să îl deschizi.",
"openFolder": "Deschide dosarul",
"pause": "Pune pe pauză",
"pauseTooltipBatch": "Pune pe pauză: {{n}} din selecția totală de {{total}}",
diff --git a/src/shared/locales/ru.json b/src/shared/locales/ru.json
index b7f91834..3b28820f 100644
--- a/src/shared/locales/ru.json
+++ b/src/shared/locales/ru.json
@@ -927,6 +927,8 @@
"removeMixedTitle": "Удалить задачи из списка ({{count}})?",
"openFile": "Открыть файл",
"openFileFailed": "Не удалось открыть файл",
+ "openFileAppFailed": "Система не смогла открыть этот файл. Проверьте, установлено ли ещё приложение по умолчанию, или откройте папку, чтобы выбрать другое приложение.",
+ "openFileFailedHint": "Проверьте, существует ли файл и есть ли у вас разрешение на его открытие.",
"chooseFiles": "Выбрать файлы…",
"queueOrder": "Порядок загрузки",
"moveQueueTop": "В начало очереди",
diff --git a/src/shared/locales/th.json b/src/shared/locales/th.json
index 4cc34c23..25f77eb1 100644
--- a/src/shared/locales/th.json
+++ b/src/shared/locales/th.json
@@ -844,6 +844,8 @@
"moveQueueUp": "เลื่อนขึ้นในคิว",
"openFile": "เปิดไฟล์",
"openFileFailed": "เปิดไฟล์ไม่ได้",
+ "openFileAppFailed": "ระบบไม่สามารถเปิดไฟล์นี้ได้ โปรดตรวจสอบว่าแอปเริ่มต้นยังติดตั้งอยู่ หรือเปิดโฟลเดอร์เพื่อเลือกแอปอื่น",
+ "openFileFailedHint": "โปรดตรวจสอบว่าไฟล์ยังอยู่และคุณมีสิทธิ์เปิดไฟล์",
"openFolder": "เปิดโฟลเดอร์",
"pause": "พัก",
"pauseTooltipBatch": "พัก {{n}} จาก {{total}} งานที่เลือก",
diff --git a/src/shared/locales/tr.json b/src/shared/locales/tr.json
index 7a06a1ca..2042fd64 100644
--- a/src/shared/locales/tr.json
+++ b/src/shared/locales/tr.json
@@ -903,6 +903,8 @@
"removeMixedTitle": "{{count}} görev listeden kaldırılsın mı?",
"openFile": "Dosyayı aç",
"openFileFailed": "Dosya açılamadı",
+ "openFileAppFailed": "Sistem bu dosyayı açamadı. Varsayılan uygulamanın hâlâ yüklü olduğunu kontrol edin veya başka bir uygulama seçmek için klasörü açın.",
+ "openFileFailedHint": "Dosyanın hâlâ var olduğunu ve onu açma izninizin bulunduğunu kontrol edin.",
"chooseFiles": "Dosyaları seç…",
"queueOrder": "İndirme sırası",
"moveQueueTop": "Başa Taşı",
diff --git a/src/shared/locales/uk.json b/src/shared/locales/uk.json
index 314ebedb..5ae9bf6d 100644
--- a/src/shared/locales/uk.json
+++ b/src/shared/locales/uk.json
@@ -853,6 +853,8 @@
"moveQueueUp": "Перемістити вище в черзі",
"openFile": "Відкрити файл",
"openFileFailed": "Не вдалося відкрити файл",
+ "openFileAppFailed": "Системі не вдалося відкрити цей файл. Перевірте, чи досі встановлено типову програму, або відкрийте теку, щоб вибрати іншу програму.",
+ "openFileFailedHint": "Перевірте, чи файл досі існує і чи маєте ви дозвіл на його відкриття.",
"openFolder": "Відкрити теку",
"pause": "Призупинити",
"pauseTooltipBatch": "Призупинити {{n}} з {{total}} вибраних",
diff --git a/src/shared/locales/vi.json b/src/shared/locales/vi.json
index 65772fea..4ee868ba 100644
--- a/src/shared/locales/vi.json
+++ b/src/shared/locales/vi.json
@@ -891,6 +891,8 @@
"removeMixedTitle": "Xóa {{count}} tác vụ khỏi danh sách?",
"openFile": "Mở tệp",
"openFileFailed": "Không thể mở tệp",
+ "openFileAppFailed": "Hệ thống không thể mở tệp này. Hãy kiểm tra xem ứng dụng mặc định còn được cài đặt hay không, hoặc mở thư mục để chọn ứng dụng khác.",
+ "openFileFailedHint": "Hãy kiểm tra xem tệp còn tồn tại và bạn có quyền mở tệp hay không.",
"chooseFiles": "Chọn tệp…",
"queueOrder": "Thứ tự tải xuống",
"moveQueueTop": "Chuyển lên đầu",
diff --git a/src/shared/locales/zh-CN.json b/src/shared/locales/zh-CN.json
index 47231aef..3340de93 100644
--- a/src/shared/locales/zh-CN.json
+++ b/src/shared/locales/zh-CN.json
@@ -891,6 +891,8 @@
"removeMixedTitle": "移除 {{count}} 个任务?",
"openFile": "打开文件",
"openFileFailed": "无法打开文件",
+ "openFileAppFailed": "系统无法打开此文件。请检查默认应用是否仍已安装,或通过“打开文件夹”选择其他应用打开。",
+ "openFileFailedHint": "请确认文件仍然存在,并且你有权限打开它。",
"chooseFiles": "选择下载文件…",
"queueOrder": "调整下载顺序",
"moveQueueTop": "移至队列最前",
diff --git a/src/shared/locales/zh-TW.json b/src/shared/locales/zh-TW.json
index af1878bd..3affdf1d 100644
--- a/src/shared/locales/zh-TW.json
+++ b/src/shared/locales/zh-TW.json
@@ -891,6 +891,8 @@
"removeMixedTitle": "要移除 {{count}} 個任務嗎?",
"openFile": "開啟檔案",
"openFileFailed": "無法開啟檔案",
+ "openFileAppFailed": "系統無法開啟此檔案。請檢查預設應用程式是否仍已安裝,或透過「開啟資料夾」選擇其他應用程式開啟。",
+ "openFileFailedHint": "請確認檔案仍然存在,而且你有權限開啟它。",
"chooseFiles": "選擇下載檔案…",
"queueOrder": "調整下載順序",
"moveQueueTop": "移至佇列最前",