1
0
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:
Laurent Cozic
2018-05-01 19:05:14 +01:00
parent 398946d39a
commit 1ba3fae101
5 changed files with 16 additions and 0 deletions

View File

@ -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);