download at best effort
This commit is contained in:
parent
e74e49538e
commit
a2ce95441a
@ -986,11 +986,24 @@ export class FakeFsOnedrive extends FakeFs {
|
|||||||
).arrayBuffer;
|
).arrayBuffer;
|
||||||
return content;
|
return content;
|
||||||
} else {
|
} else {
|
||||||
|
// so strange, sometimes (!!!)
|
||||||
|
// we cannot download the file because of CORS
|
||||||
|
try {
|
||||||
// cannot set no-cache here, will have cors error
|
// cannot set no-cache here, will have cors error
|
||||||
const content = await (
|
const content = await (
|
||||||
await fetch(downloadUrl, { cache: "no-store" })
|
await fetch(downloadUrl, { cache: "no-store" })
|
||||||
).arrayBuffer();
|
).arrayBuffer();
|
||||||
return content;
|
return content;
|
||||||
|
} catch (e) {
|
||||||
|
// let's try again to bypass the CORS
|
||||||
|
const content = (
|
||||||
|
await requestUrl({
|
||||||
|
url: downloadUrl,
|
||||||
|
headers: { "Cache-Control": "no-cache" },
|
||||||
|
})
|
||||||
|
).arrayBuffer;
|
||||||
|
return content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user