You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
All: Resolves #470: Make it clear that spaces in URLs are invalid.
This commit is contained in:
@ -5,6 +5,7 @@ const { FileApiDriverLocal } = require('lib/file-api-driver-local.js');
|
||||
const { time } = require('lib/time-utils.js');
|
||||
const { setLocale, defaultLocale, closestSupportedLocale } = require('lib/locale.js');
|
||||
const { FsDriverNode } = require('lib/fs-driver-node.js');
|
||||
const urlValidator = require('valid-url');
|
||||
|
||||
function shimInit() {
|
||||
shim.fsDriver = () => { throw new Error('Not implemented') }
|
||||
@ -133,6 +134,9 @@ function shimInit() {
|
||||
}
|
||||
|
||||
shim.fetch = async function(url, options = null) {
|
||||
const validatedUrl = urlValidator.isUri(url);
|
||||
if (!validatedUrl) throw new Error('Not a valid URL: ' + url);
|
||||
|
||||
return shim.fetchWithRetry(() => {
|
||||
return nodeFetch(url, options)
|
||||
}, options);
|
||||
|
Reference in New Issue
Block a user