normalize-url
Advanced tools
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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18099
340