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.4.1 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",

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