mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
This commit is contained in:
parent
fa67b7193c
commit
9bccf787a5
@ -68,8 +68,7 @@
|
||||
"stream-browserify": "^3.0.0",
|
||||
"string-natural-compare": "^2.0.2",
|
||||
"timers": "^0.1.1",
|
||||
"url": "^0.11.0",
|
||||
"valid-url": "^1.0.9"
|
||||
"url": "^0.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.9",
|
||||
|
@ -4,7 +4,6 @@ const PoorManIntervals = require('@joplin/lib/PoorManIntervals').default;
|
||||
const RNFetchBlob = require('rn-fetch-blob').default;
|
||||
const { generateSecureRandom } = require('react-native-securerandom');
|
||||
const FsDriverRN = require('./fs-driver-rn').default;
|
||||
const urlValidator = require('valid-url');
|
||||
const { Buffer } = require('buffer');
|
||||
const { Linking, Platform } = require('react-native');
|
||||
const mimeUtils = require('@joplin/lib/mime-utils.js').mime;
|
||||
@ -88,8 +87,12 @@ function shimInit() {
|
||||
// "http://ocloud. de" so detect if the URL is valid beforehand and
|
||||
// throw a catchable error. Bug:
|
||||
// https://github.com/facebook/react-native/issues/7436
|
||||
const validatedUrl = urlValidator.isUri(url);
|
||||
if (!validatedUrl) throw new Error(`Not a valid URL: ${url}`);
|
||||
let validatedUrl = '';
|
||||
try { // Check if the url is valid
|
||||
validatedUrl = new URL(url).href;
|
||||
} catch (error) { // If the url is not valid, a TypeError will be thrown
|
||||
throw new Error(`Not a valid URL: ${url}`);
|
||||
}
|
||||
|
||||
return shim.fetchWithRetry(() => {
|
||||
// If the request has a body and it's not a GET call, and it
|
||||
|
@ -89,7 +89,6 @@
|
||||
"uglifycss": "0.0.29",
|
||||
"url-parse": "^1.4.7",
|
||||
"uuid": "^3.0.1",
|
||||
"valid-url": "^1.0.9",
|
||||
"word-wrap": "^1.2.3",
|
||||
"xml2js": "^0.4.19"
|
||||
},
|
||||
|
@ -9,7 +9,6 @@ const FsDriverNode = require('./fs-driver-node').default;
|
||||
const mimeUtils = require('./mime-utils.js').mime;
|
||||
const Note = require('./models/Note').default;
|
||||
const Resource = require('./models/Resource').default;
|
||||
const urlValidator = require('valid-url');
|
||||
const { _ } = require('./locale');
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
@ -446,8 +445,11 @@ function shimInit(options = null) {
|
||||
};
|
||||
|
||||
shim.fetch = async function(url, options = {}) {
|
||||
const validatedUrl = urlValidator.isUri(url);
|
||||
if (!validatedUrl) throw new Error(`Not a valid URL: ${url}`);
|
||||
try { // Check if the url is valid
|
||||
new URL(url);
|
||||
} catch (error) { // If the url is not valid, a TypeError will be thrown
|
||||
throw new Error(`Not a valid URL: ${url}`);
|
||||
}
|
||||
const resolvedProxyUrl = resolveProxyUrl(proxySettings.proxyUrl);
|
||||
options.agent = (resolvedProxyUrl && proxySettings.proxyEnabled) ? shim.proxyAgent(url, resolvedProxyUrl) : null;
|
||||
return shim.fetchWithRetry(() => {
|
||||
|
@ -4193,7 +4193,6 @@ __metadata:
|
||||
typescript: ^4.7.4
|
||||
uglify-js: ^3.13.10
|
||||
url: ^0.11.0
|
||||
valid-url: ^1.0.9
|
||||
webpack: ^5.74.0
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
@ -4327,7 +4326,6 @@ __metadata:
|
||||
uglifycss: 0.0.29
|
||||
url-parse: ^1.4.7
|
||||
uuid: ^3.0.1
|
||||
valid-url: ^1.0.9
|
||||
word-wrap: ^1.2.3
|
||||
xml2js: ^0.4.19
|
||||
languageName: unknown
|
||||
@ -34438,13 +34436,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"valid-url@npm:^1.0.9":
|
||||
version: 1.0.9
|
||||
resolution: "valid-url@npm:1.0.9"
|
||||
checksum: 3ecb030559404441c2cf104cbabab8770efb0f36d117db03d1081052ef133015a68806148ce954bb4dd0b5c42c14b709a88783c93d66b0916cb67ba771c98702
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"validate-npm-package-license@npm:^3.0.1, validate-npm-package-license@npm:^3.0.3":
|
||||
version: 3.0.4
|
||||
resolution: "validate-npm-package-license@npm:3.0.4"
|
||||
|
Loading…
Reference in New Issue
Block a user