Socket
Socket
Sign inDemoInstall

content-disposition

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.0 to 0.4.0

5

HISTORY.md

@@ -0,1 +1,6 @@

0.4.0 / 2014-09-21
==================
* Expand non-Unicode `filename` to the full ISO-8859-1 charset
0.3.0 / 2014-09-20

@@ -2,0 +7,0 @@ ==================

30

index.js

@@ -20,8 +20,2 @@ /*!

/**
* RegExp to match US-ASCII string
*/
var asciiStringRegExp = /^[\x00-\x7f]*$/
/**
* RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%")

@@ -39,6 +33,6 @@ */

/**
* RegExp to match non-US-ASCII characters.
* RegExp to match non-RFC 2616 text characters.
*/
var nonAsciiRegExp = /[^\x00-\x7f]/g
var nonTextRegExp = /[^\x20-\x7e\x80-\xff]/g

@@ -114,4 +108,4 @@ /**

if (typeof fallback === 'string' && nonAsciiRegExp.test(fallback)) {
throw new TypeError('option fallback must be US-ASCII string')
if (typeof fallback === 'string' && nonTextRegExp.test(fallback)) {
throw new TypeError('option fallback must be ISO-8859-1 string')
}

@@ -124,8 +118,8 @@

var fallbackName = typeof fallback !== 'string'
? fallback && getascii(name)
? fallback && getlatin1(name)
: basename(fallback)
var isSimpleHeader = (typeof fallbackName !== 'string' || fallbackName === name)
&& asciiStringRegExp.test(name)
&& !hexEscapeRegExp.test(name)
&& textRegExp.test(name)

@@ -144,3 +138,3 @@ if (isSimpleHeader) {

/**
* Get US-ASCII version of string.
* Get ISO-8859-1 version of string.
*

@@ -152,5 +146,5 @@ * @param {string} val

function getascii(val) {
// simple Unicode -> US-ASCII transformation
return String(val).replace(nonAsciiRegExp, '?')
function getlatin1(val) {
// simple Unicode -> ISO-8859-1 transformation
return String(val).replace(nonTextRegExp, '?')
}

@@ -187,6 +181,2 @@

if (str.length > 0 && !textRegExp.test(str)) {
throw new TypeError('invalid quoted string value')
}
return '"' + str.replace(quoteRegExp, '\\$1') + '"'

@@ -193,0 +183,0 @@ }

{
"name": "content-disposition",
"description": "Create an attachment Content-Disposition header",
"version": "0.3.0",
"version": "0.4.0",
"contributors": [

@@ -6,0 +6,0 @@ "Douglas Christopher Wilson <doug@somethingdoug.com>"

@@ -33,2 +33,6 @@ # content-disposition

**note** HTTP headers are of the ISO-8859-1 character set. If you are writing this
header through a means different from `setHeader` in Node.js, you'll want to specify
the `'binary'` encoding in Node.js.
#### Options

@@ -40,18 +44,18 @@

If the `filename` option is outside US-ASCII, then the file name is actually
If the `filename` option is outside ISO-8859-1, then the file name is actually
stored in a supplemental field for clients that support Unicode file names and
a US-ASCII version of the file name is automatically generated.
a ISO-8859-1 version of the file name is automatically generated.
This specifies the US-ASCII file name to override the automatic generation or
This specifies the ISO-8859-1 file name to override the automatic generation or
disables the generation all together, defaults to `true`.
- A string will specify the US-ASCII file name to use in place of automatic
- A string will specify the ISO-8859-1 file name to use in place of automatic
generation.
- `false` will disable including a US-ASCII file name and only include the
Unicode version (unless the file name is already US-ASCII).
- `true` will enable automatic generation if the file name is outside US-ASCII.
- `false` will disable including a ISO-8859-1 file name and only include the
Unicode version (unless the file name is already ISO-8859-1).
- `true` will enable automatic generation if the file name is outside ISO-8859-1.
If the `filename` option is US-ASCII and this option is specified and has a
If the `filename` option is ISO-8859-1 and this option is specified and has a
different value, then the `filename` option is encoded in the extended field
and this set as the fallback field, even though they are both US-ASCII.
and this set as the fallback field, even though they are both ISO-8859-1.

@@ -58,0 +62,0 @@ ##### type

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