You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Various tweaks to get Nextcloud working in mobile
This commit is contained in:
@ -28,7 +28,19 @@ function shimInit() {
|
||||
|
||||
shim.fetch = async function(url, options = null) {
|
||||
return shim.fetchWithRetry(() => {
|
||||
return shim.nativeFetch_(url, options)
|
||||
// The native fetch() throws an uncatable error if calling it with an invalid URL
|
||||
// such as '//.resource' so detect if the URL is valid beforehand and throw
|
||||
// a catchable error.
|
||||
|
||||
if (typeof url !== 'string') {
|
||||
console.info('NOT A STRING: ', url);
|
||||
throw new Error('shim.fetch: URL is not a string');
|
||||
}
|
||||
|
||||
const lcUrl = url.toLowerCase();
|
||||
if (lcUrl.indexOf('http:') !== 0 && lcUrl.indexOf('https:') !== 0) throw new Error('shim.fetch: Invalid URL: ' + lcUrl);
|
||||
|
||||
return shim.nativeFetch_(url, options);
|
||||
}, options);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user