From d9e81dd27ab09c49108e1fda7bb85c6dd99c24b0 Mon Sep 17 00:00:00 2001 From: Aswin S Date: Thu, 29 Feb 2024 14:39:54 +0530 Subject: [PATCH] Revert "Merge pull request #651 from aswin-s/fix/issue-34324" This reverts commit 83ae6194b3e4feb363ea9d061085a7ab76e35ffb, reversing changes made to 17e8f75d879b4a63ec06932cc8fca3e5a6534395. --- __tests__/URL-test.js | 6 ------ lib/Url.js | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/__tests__/URL-test.js b/__tests__/URL-test.js index c5f01be5..1474663b 100644 --- a/__tests__/URL-test.js +++ b/__tests__/URL-test.js @@ -19,12 +19,6 @@ describe('Strict URL validation', () => { expect(regexToTest.test('https://google.com:65536')).toBeFalsy(); expect(regexToTest.test('smtp://google.com')).toBeFalsy(); }); - - it('should not match urls inside tags', () => { - const regexToTest = new RegExp(`^${URL_REGEX_WITH_REQUIRED_PROTOCOL}$`, 'i'); - expect(regexToTest.test('http://google.com/')).toBeFalsy(); - expect(regexToTest.test('
http://google.com/
')).toBeFalsy(); - }); }); describe('Optional protocol for URL', () => { diff --git a/lib/Url.js b/lib/Url.js index 9d2a9108..5b89696c 100644 --- a/lib/Url.js +++ b/lib/Url.js @@ -2,8 +2,7 @@ import TLD_REGEX from './tlds'; const ALLOWED_PORTS = '([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])'; const URL_PROTOCOL_REGEX = '((ht|f)tps?:\\/\\/)'; -const URL_WEBSITE_REGEX = `${URL_PROTOCOL_REGEX}?((?:www\\.)?[a-z0-9](?=(?