Merge branch 'master' into stable24

old_stable24
Varun Patil 2023-02-26 13:54:25 -08:00
commit 8afd585377
3 changed files with 11 additions and 21 deletions

View File

@ -14,7 +14,7 @@
v-for="item in navItems"
:key="item.name"
:to="{ name: item.name }"
:title="item.title"
:name="item.title"
@click="linkClick"
exact
>
@ -24,7 +24,7 @@
<template #footer>
<NcAppNavigationItem
:title="t('memories', 'Settings')"
:name="t('memories', 'Settings')"
@click="showSettings"
>
<CogIcon slot="icon" :size="20" />

View File

@ -79,14 +79,7 @@ async function flushPreviewQueue() {
fetchPreviewQueueCopy
.filter((p) => p.reqid === reqid)
.forEach((p) => {
p.callback(
getResponse(imgBlob, imgType, {
"Content-Type": imgType,
"Content-Length": imgLen,
"Cache-Control": res.headers["Cache-Control"],
Expires: res.headers["Expires"],
})
);
p.callback(getResponse(imgBlob, imgType, res.headers));
p.callback = null;
});
}
@ -159,16 +152,17 @@ export async function fetchOneImage(url: string) {
const res = await axios.get(url, {
responseType: "blob",
});
return getResponse(res.data, res.headers["content-type"], res.headers);
return getResponse(res.data, null, res.headers);
}
function getResponse(blob: Blob, type: string, headers: any = {}) {
function getResponse(blob: Blob, type: string | null, headers: any = {}) {
return new Response(blob, {
status: 200,
headers: {
"Content-Type": type,
"Content-Type": type || headers["content-type"],
"Content-Length": blob.size.toString(),
...headers,
"Cache-Control": headers["cache-control"],
Expires: headers["expires"],
},
});
}

View File

@ -182,6 +182,7 @@ import { getRootUrl } from "@nextcloud/router";
import { getPreviewUrl } from "../../services/FileUtils";
import { getDownloadLink } from "../../services/DavRequests";
import { API } from "../../services/API";
import { fetchImage } from "../frame/XImgCache";
import * as dav from "../../services/DavRequests";
import * as utils from "../../services/Utils";
@ -862,12 +863,6 @@ export default defineComponent({
// Check navigator support
if (!this.canShare) throw new Error("Share not supported");
// Get image data from active slide
const img = document.querySelector(
".pswp__item.active img.pswp__img"
) as HTMLImageElement;
if (!img?.src) return;
// Shre image data using navigator api
const photo = this.currentPhoto;
if (!photo) return;
@ -879,7 +874,8 @@ export default defineComponent({
);
// Get image blob
const blob = await (await fetch(img.src)).blob();
const imgSrc = this.photoswipe.currSlide.data.src;
const blob = await fetchImage(imgSrc);
// Fix basename extension
let basename = photo.basename;