@tinyhttp/content-disposition
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -18,5 +18,4 @@ export declare class ContentDisposition { | ||
* Parse Content-Disposition header string. | ||
* @param string string | ||
* @param header string | ||
*/ | ||
export declare function parse(string: string): ContentDisposition; | ||
//# sourceMappingURL=index.d.ts.map | ||
export declare function parse(header: string): ContentDisposition; |
@@ -40,3 +40,3 @@ const ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g; | ||
for (const param of params) { | ||
const val = param.substr(-1) === "*" ? ustring(parameters[param]) : qstring(parameters[param]); | ||
const val = param.slice(-1) === "*" ? ustring(parameters[param]) : qstring(parameters[param]); | ||
string += "; " + param + "=" + val; | ||
@@ -95,4 +95,4 @@ } | ||
} | ||
function parse(string) { | ||
let match = DISPOSITION_TYPE_REGEXP.exec(string); | ||
function parse(header) { | ||
let match = DISPOSITION_TYPE_REGEXP.exec(header); | ||
if (!match) | ||
@@ -106,4 +106,4 @@ throw new TypeError("invalid type format"); | ||
let value; | ||
index = PARAM_REGEXP.lastIndex = match[0].substr(-1) === ";" ? index - 1 : index; | ||
while (match = PARAM_REGEXP.exec(string)) { | ||
index = PARAM_REGEXP.lastIndex = match[0].slice(-1) === ";" ? index - 1 : index; | ||
while (match = PARAM_REGEXP.exec(header)) { | ||
if (match.index !== index) | ||
@@ -127,7 +127,7 @@ throw new TypeError("invalid parameter format"); | ||
if (value[0] === '"') { | ||
value = value.substr(1, value.length - 2).replace(QESC_REGEXP, "$1"); | ||
value = value.slice(1, value.length - 1).replace(QESC_REGEXP, "$1"); | ||
} | ||
params[key] = value; | ||
} | ||
if (index !== -1 && index !== string.length) { | ||
if (index !== -1 && index !== header.length) { | ||
throw new TypeError("invalid parameter format"); | ||
@@ -142,1 +142,2 @@ } | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@tinyhttp/content-disposition", | ||
"description": "content-disposition rewrite in TypeScript", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "homepage": "https://tinyhttp.v1rtl.site", |
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
20704
158