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: {
async getHead () {
console.log("getHead", this.value?.path);
if (this.value?.path) {
const url = `/files/${this.value.path}`;
const init = {
text: true,
headers: {
"Range": `bytes=0-${this.sampleSize}`
}
};
const head = await this.api([url, init]);
return head?.substring(0, head.lastIndexOf("\n")) || "";
const opts = {format: "text"};
const head = await this.api([url, init, null, opts]);
return typeof head === "string"
? head?.substring(0, head.lastIndexOf("\n")) || ""
: this.head ?? "";
}
return "";
},