diff --git a/packages/block-editor/src/components/link-control/index.js b/packages/block-editor/src/components/link-control/index.js
index 4bbb1c1232b7bb..7dab2575c08989 100644
--- a/packages/block-editor/src/components/link-control/index.js
+++ b/packages/block-editor/src/components/link-control/index.js
@@ -16,7 +16,7 @@ import {
prependHTTP,
getProtocol,
isValidFragment,
- isUri,
+ isURI,
} from '@wordpress/url';
import { useInstanceId } from '@wordpress/compose';
import { useSelect } from '@wordpress/data';
@@ -95,7 +95,7 @@ function LinkControl( {
const isInternal = startsWith( val, '#' ) && isValidFragment( val );
const includesWWW = !! ( val && val.includes( 'www.' ) );
- return isUri( val ) || includesWWW || isInternal;
+ return isURI( val ) || includesWWW || isInternal;
};
// Effects
diff --git a/packages/url/README.md b/packages/url/README.md
index 7b59a0258a442c..b2c8ef773b7eae 100644
--- a/packages/url/README.md
+++ b/packages/url/README.md
@@ -230,6 +230,7 @@ _Returns_
# **isURI**
Determines whether the given string looks like a URI (of any type).
+See for more info.
_Usage_
diff --git a/packages/url/package.json b/packages/url/package.json
index bd92afdcb1e6fc..bd74b58a711baa 100644
--- a/packages/url/package.json
+++ b/packages/url/package.json
@@ -25,7 +25,7 @@
"@babel/runtime": "^7.4.4",
"lodash": "^4.17.15",
"qs": "^6.5.2",
- "valid-url": "^1.0.9"
+ "whatwg-url": "^8.0.0"
},
"publishConfig": {
"access": "public"
diff --git a/packages/url/src/is-uri.js b/packages/url/src/is-uri.js
index 6f98411c5e510a..1ec8c8c10d7dde 100644
--- a/packages/url/src/is-uri.js
+++ b/packages/url/src/is-uri.js
@@ -1,10 +1,11 @@
/**
* External dependencies
*/
-import { isUri } from 'valid-url';
+import { URL } from 'whatwg-url';
/**
* Determines whether the given string looks like a URI (of any type).
+ * See https://url.spec.whatwg.org/#url-representation for more info.
*
* @param {string} uri The string to scrutinise.
*
@@ -17,5 +18,10 @@ import { isUri } from 'valid-url';
* @return {boolean} Whether or not it looks like a URI.
*/
export function isURI( uri ) {
- return isUri( uri );
+ try {
+ new URL( uri );
+ return true;
+ } catch ( _ ) {
+ return false;
+ }
}