From 3cb0abaea7d44fed0e4d1b9caf43f4fd58cef4b5 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Fri, 2 Dec 2022 23:30:18 -0800 Subject: [PATCH] download: always generate url --- src/components/Viewer.vue | 5 +---- src/services/dav/download.ts | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/Viewer.vue b/src/components/Viewer.vue index 3fc74652..0020a343 100644 --- a/src/components/Viewer.vue +++ b/src/components/Viewer.vue @@ -136,7 +136,6 @@ import { IDay, IPhoto, IRow, IRowType } from "../types"; import NcActions from "@nextcloud/vue/dist/Components/NcActions"; import NcActionButton from "@nextcloud/vue/dist/Components/NcActionButton"; import { subscribe, unsubscribe } from "@nextcloud/event-bus"; -import { generateUrl } from "@nextcloud/router"; import { showError } from "@nextcloud/dialogs"; import * as dav from "../services/DavRequests"; @@ -658,10 +657,8 @@ export default class Viewer extends Mixins(GlobalMixin) { const isvideo = photo.flag & this.c.FLAG_IS_VIDEO; // Preview aren't animated - if (photo.mimetype === "image/gif") { + if (isvideo || photo.mimetype === "image/gif") { previewUrl = getDownloadLink(photo); - } else if (isvideo) { - previewUrl = generateUrl(getDownloadLink(photo)); } // Get height and width diff --git a/src/services/dav/download.ts b/src/services/dav/download.ts index 4684a371..3c47c1e2 100644 --- a/src/services/dav/download.ts +++ b/src/services/dav/download.ts @@ -98,9 +98,9 @@ export function getDownloadLink(photo: IPhoto) { route.params.name ); if (fInfos.length) { - return `/remote.php/dav${fInfos[0].originalFilename}`; + return generateUrl(`/remote.php/dav${fInfos[0].originalFilename}`); } } - return `/remote.php/dav${photo.filename}`; + return generateUrl(`/remote.php/dav${photo.filename}`); }