handle custom protocols gracefully

This commit is contained in:
Aiden McClelland 2020-10-07 11:29:47 -06:00
parent 5aaeb3b76d
commit 1341e89076
No known key found for this signature in database
GPG Key ID: 45C49185E315A11D

View File

@ -85,6 +85,10 @@ export function download (format, ...files) {
export async function post (url, content = '', overwrite = false, onupload) {
url = removePrefix(url)
if (content instanceof Blob && !['http:', 'https:'].includes(window.location.protocol)) {
content = await content.arrayBuffer()
}
return new Promise((resolve, reject) => {
let request = new XMLHttpRequest()
request.open('POST', `${baseURL}/api/resources${url}?override=${overwrite}`, true)