Skip to content

Commit 75f0c1c

Browse files
authored
fix ZipArchiveEntry (#1126)
1 parent 9962d20 commit 75f0c1c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/client/stdlib/fileAttachment.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function FileAttachment(name, base = location) {
1616
}
1717

1818
async function remote_fetch(file) {
19-
const response = await fetch(file.href);
19+
const response = await fetch(await file.url());
2020
if (!response.ok) throw new Error(`Unable to load file: ${file.name}`);
2121
return response;
2222
}
@@ -57,13 +57,14 @@ export class AbstractFile {
5757
return dsv(this, "\t", options);
5858
}
5959
async image(props) {
60+
const url = await this.url();
6061
return new Promise((resolve, reject) => {
6162
const i = new Image();
62-
if (new URL(this.href, document.baseURI).origin !== new URL(location).origin) i.crossOrigin = "anonymous";
63+
if (new URL(url, document.baseURI).origin !== new URL(location).origin) i.crossOrigin = "anonymous";
6364
Object.assign(i, props);
6465
i.onload = () => resolve(i);
6566
i.onerror = () => reject(new Error(`Unable to load file: ${this.name}`));
66-
i.src = this.href;
67+
i.src = url;
6768
});
6869
}
6970
async arrow() {
@@ -99,7 +100,6 @@ class FileAttachmentImpl extends AbstractFile {
99100
super(name, mimeType, lastModified);
100101
Object.defineProperty(this, "href", {value: href});
101102
}
102-
/** @deprecated Use this.href instead. */
103103
async url() {
104104
return this.href;
105105
}

0 commit comments

Comments
 (0)