download: always generate url

cap
Varun Patil 2022-12-02 23:30:18 -08:00
parent 274951b9f9
commit 3cb0abaea7
2 changed files with 3 additions and 6 deletions

View File

@ -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

View File

@ -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}`);
}