🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

normalize-url

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

normalize-url - npm Package Compare versions

Comparing version

to
4.5.0

14

index.js

@@ -5,2 +5,6 @@ 'use strict';

// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
const DATA_URL_DEFAULT_MIME_TYPE = 'text/plain';
const DATA_URL_DEFAULT_CHARSET = 'us-ascii';
const testParameter = (name, filters) => {

@@ -31,3 +35,2 @@ return filters.some(filter => filter instanceof RegExp ? filter.test(name) : filter === name);

const attributes = mediaType
.filter(Boolean)
.map(attribute => {

@@ -39,6 +42,11 @@ let [key, value = ''] = attribute.split('=').map(string => string.trim());

value = value.toLowerCase();
if (value === DATA_URL_DEFAULT_CHARSET) {
return '';
}
}
return `${key}${value ? `=${value}` : ''}`;
});
})
.filter(Boolean);

@@ -53,3 +61,3 @@ const normalizedMediaType = [

if (normalizedMediaType.length !== 0 || mimeType) {
if (normalizedMediaType.length !== 0 || (mimeType && mimeType !== DATA_URL_DEFAULT_MIME_TYPE)) {
normalizedMediaType.unshift(mimeType);

@@ -56,0 +64,0 @@ }

{
"name": "normalize-url",
"version": "4.4.1",
"version": "4.5.0",
"description": "Normalize a URL",

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