Fix retrieval of preplot previews

This commit is contained in:
D. Berge
2025-08-07 16:20:00 +02:00
parent e5679ec14b
commit 544117eec3

View File

@@ -519,17 +519,18 @@ export default {
methods: { methods: {
async getHead () { async getHead () {
console.log("getHead", this.value?.path);
if (this.value?.path) { if (this.value?.path) {
const url = `/files/${this.value.path}`; const url = `/files/${this.value.path}`;
const init = { const init = {
text: true,
headers: { headers: {
"Range": `bytes=0-${this.sampleSize}` "Range": `bytes=0-${this.sampleSize}`
} }
}; };
const head = await this.api([url, init]); const opts = {format: "text"};
return head?.substring(0, head.lastIndexOf("\n")) || ""; const head = await this.api([url, init, null, opts]);
return typeof head === "string"
? head?.substring(0, head.lastIndexOf("\n")) || ""
: this.head ?? "";
} }
return ""; return "";
}, },