@@ -50,16 +50,6 @@ const getFinalUrl = (page: Page) => {
5050 return finalUrl ;
5151} ;
5252
53- function cleanUrl ( url : string ) : string {
54- // Remove the protocol (http:// or https://)
55- url = url . replace ( / ^ h t t p s ? : \/ \/ / , '' ) ;
56-
57- // Remove trailing slashes
58- url = url . replace ( / \/ $ / , '' ) ;
59-
60- return url ;
61- }
62-
6353function removeWww ( url : string ) : string {
6454 return url . replace ( / ^ w w w \. / , '' ) ;
6555}
@@ -68,7 +58,7 @@ function removeWww(url: string): string {
6858 * Compares the initial URL and final URL to determine if a redirect occurred
6959 *
7060 * @param initialUrl The initial URL that is being scanned. Stored as the `url` property in the CoreInputDto
71- * @param finalUrl The final URL after all redirects. Stored as the `name` property in the CoreResult
61+ * @param finalUrl The final URL after all redirects. Stored as the `name` property in the CoreResult after removing www.
7262 * @param logger
7363 * @returns true if the initial URL and final URL are the same, false if they are different, and null if either is missing
7464 */
@@ -78,16 +68,15 @@ function isRedirect(initialUrl: string, finalUrl: string, logger: Logger): boole
7868 return null ;
7969 }
8070
81- initialUrl = cleanUrl ( initialUrl ) ;
82- finalUrl = removeWww ( cleanUrl ( finalUrl ) ) ;
71+ finalUrl = removeWww ( finalUrl ) ;
8372
8473 if ( initialUrl === finalUrl ) {
8574 logger . info ( { redirectCheck : { initialUrl, finalUrl} } , 'Initial URL and final URL are the same.' ) ;
86- return true ;
75+ return false ;
8776 }
8877 if ( initialUrl && finalUrl ) {
8978 logger . info ( { redirectCheck : { initialUrl, finalUrl} } , 'Initial URL and final URL are different.' ) ;
90- return false ;
79+ return true ;
9180 }
9281
9382 return null ;
0 commit comments