Socket
Socket
Sign inDemoInstall

normalize-url

Package Overview
Dependencies
0
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0 to 4.1.0

8

index.js

@@ -77,3 +77,3 @@ 'use strict';

// `urlObj.pathname = urlObj.pathname.replace(/(?<!https?:)\/{2,}/g, '/');`
urlObj.pathname = urlObj.pathname.replace(/((?![https?:]).)\/{2,}/g, (_, p1) => {
urlObj.pathname = urlObj.pathname.replace(/((?!:).|^)\/{2,}/g, (_, p1) => {
if (/^(?!\/)/g.test(p1)) {

@@ -133,2 +133,6 @@ return `${p1}/`;

if (options.removeTrailingSlash) {
urlObj.pathname = urlObj.pathname.replace(/\/$/, '');
}
// Take advantage of many of the Node `url` normalizations

@@ -138,3 +142,3 @@ urlString = urlObj.toString();

// Remove ending `/`
if (options.removeTrailingSlash || urlObj.pathname === '/') {
if ((options.removeTrailingSlash || urlObj.pathname === '/') && urlObj.hash === '') {
urlString = urlString.replace(/\/$/, '');

@@ -141,0 +145,0 @@ }

{
"name": "normalize-url",
"version": "4.0.0",
"version": "4.1.0",
"description": "Normalize a URL",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc