File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export function FileAttachment(name, base = location) {
16
16
}
17
17
18
18
async function remote_fetch ( file ) {
19
- const response = await fetch ( file . href ) ;
19
+ const response = await fetch ( await file . url ( ) ) ;
20
20
if ( ! response . ok ) throw new Error ( `Unable to load file: ${ file . name } ` ) ;
21
21
return response ;
22
22
}
@@ -57,13 +57,14 @@ export class AbstractFile {
57
57
return dsv ( this , "\t" , options ) ;
58
58
}
59
59
async image ( props ) {
60
+ const url = await this . url ( ) ;
60
61
return new Promise ( ( resolve , reject ) => {
61
62
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" ;
63
64
Object . assign ( i , props ) ;
64
65
i . onload = ( ) => resolve ( i ) ;
65
66
i . onerror = ( ) => reject ( new Error ( `Unable to load file: ${ this . name } ` ) ) ;
66
- i . src = this . href ;
67
+ i . src = url ;
67
68
} ) ;
68
69
}
69
70
async arrow ( ) {
@@ -99,7 +100,6 @@ class FileAttachmentImpl extends AbstractFile {
99
100
super ( name , mimeType , lastModified ) ;
100
101
Object . defineProperty ( this , "href" , { value : href } ) ;
101
102
}
102
- /** @deprecated Use this.href instead. */
103
103
async url ( ) {
104
104
return this . href ;
105
105
}
You can’t perform that action at this time.
0 commit comments