From a463e82f83d5367690d27f53c991a5a41fca7814 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Fri, 28 Oct 2022 14:22:27 -0700 Subject: [PATCH] Show download errors --- src/services/dav/download.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/services/dav/download.ts b/src/services/dav/download.ts index da0fd675..300b305b 100644 --- a/src/services/dav/download.ts +++ b/src/services/dav/download.ts @@ -1,5 +1,7 @@ import * as base from "./base"; import { generateUrl } from "@nextcloud/router"; +import { showError } from "@nextcloud/dialogs"; +import { translate as t } from "@nextcloud/l10n"; /** * Download a file @@ -46,5 +48,12 @@ export async function downloadFilesByIds(fileIds: number[]) { // Get files to download const fileInfos = await base.getFiles(fileIds); + if (fileInfos.length !== fileIds.length) { + showError(t("memories", "Failed to download some files.")); + } + if (fileInfos.length === 0) { + return; + } + await downloadFiles(fileInfos.map((f) => f.filename)); }