-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed isURL regex to take account file urls. (#20435)
* Fixed isURL regex to take account file urls. Added unit test to validate isURL when parsing file URLs. * Change regex to support url with the format file:/ * Check for start and end of line. * Simplify test now that we test for start and end of line in regex.
- Loading branch information
1 parent
5fde188
commit 251bab4
Showing
2 changed files
with
5 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,8 +37,11 @@ describe( 'isURL', () => { | |
[ 'https://wordpress.org/./foo' ], | ||
[ 'https://wordpress.org/path?query#fragment' ], | ||
[ 'https://localhost/foo#bar' ], | ||
[ 'https:///localhost/foo#bar' ], | ||
[ 'mailto:[email protected]' ], | ||
[ 'ssh://user:[email protected]:8080' ], | ||
[ 'file:///localfolder/file.mov' ], | ||
[ 'file:/localfolder/file.mov' ], | ||
] )( 'valid (true): %s', ( url ) => { | ||
expect( isURL( url ) ).toBe( true ); | ||
} ); | ||
|