Comparing version 0.2.5 to 0.2.6
@@ -45,3 +45,3 @@ var Decoder = require('../utils').Decoder, | ||
this._key = ''; | ||
this._val = undefined; | ||
this._val = ''; | ||
this._keyTrunc = false; | ||
@@ -91,3 +91,3 @@ this._valTrunc = false; | ||
this._checkingBytes = true; | ||
this._val = undefined; | ||
this._val = ''; | ||
this._bytesVal = 0; | ||
@@ -116,3 +116,3 @@ this._valTrunc = false; | ||
this.boy.emit('field', decodeText(key, 'binary', this.charset), | ||
undefined, | ||
'', | ||
keyTrunc, | ||
@@ -159,8 +159,4 @@ false); | ||
++this._fields; | ||
if (idxamp > p) { | ||
if (this._val === undefined) | ||
this._val = this.decoder.write(data.toString('binary', p, idxamp)); | ||
else | ||
this._val += this.decoder.write(data.toString('binary', p, idxamp)); | ||
} | ||
if (idxamp > p) | ||
this._val += this.decoder.write(data.toString('binary', p, idxamp)); | ||
this.boy.emit('field', decodeText(this._key, 'binary', this.charset), | ||
@@ -184,10 +180,6 @@ decodeText(this._val, 'binary', this.charset), | ||
// we may not have hit the actual limit if there are encoded bytes... | ||
if (i > p) { | ||
if (this._val === undefined) | ||
this._val = this.decoder.write(data.toString('binary', p, i)); | ||
else | ||
this._val += this.decoder.write(data.toString('binary', p, i)); | ||
} | ||
if (i > p) | ||
this._val += this.decoder.write(data.toString('binary', p, i)); | ||
p = i; | ||
if ((this._val === undefined && this.fieldSizeLimit === 0) | ||
if ((this._val === '' && this.fieldSizeLimit === 0) | ||
|| (this._bytesVal = this._val.length) === this.fieldSizeLimit) { | ||
@@ -199,8 +191,4 @@ // yep, we actually did hit the limit | ||
} else { | ||
if (p < len) { | ||
if (this._val === undefined) | ||
this._val = this.decoder.write(data.toString('binary', p)); | ||
else | ||
this._val += this.decoder.write(data.toString('binary', p)); | ||
} | ||
if (p < len) | ||
this._val += this.decoder.write(data.toString('binary', p)); | ||
p = len; | ||
@@ -219,3 +207,3 @@ } | ||
this.boy.emit('field', decodeText(this._key, 'binary', this.charset), | ||
undefined, | ||
'', | ||
this._keyTrunc, | ||
@@ -222,0 +210,0 @@ false); |
{ "name": "busboy", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"author": "Brian White <mscdex@mscdex.net>", | ||
@@ -4,0 +4,0 @@ "description": "A streaming parser for HTML form data for node.js", |
@@ -14,3 +14,3 @@ var Busboy = require('..'); | ||
{ source: ['foo'], | ||
expected: [['foo', undefined, false, false]], | ||
expected: [['foo', '', false, false]], | ||
what: 'Unassigned value' | ||
@@ -23,3 +23,3 @@ }, | ||
{ source: ['foo&bar=baz'], | ||
expected: [['foo', undefined, false, false], | ||
expected: [['foo', '', false, false], | ||
['bar', 'baz', false, false]], | ||
@@ -30,3 +30,3 @@ what: 'Unassigned and assigned value' | ||
expected: [['foo', 'bar', false, false], | ||
['baz', undefined, false, false]], | ||
['baz', '', false, false]], | ||
what: 'Assigned and unassigned value' | ||
@@ -40,9 +40,9 @@ }, | ||
{ source: ['foo&bar'], | ||
expected: [['foo', undefined, false, false], | ||
['bar', undefined, false, false]], | ||
expected: [['foo', '', false, false], | ||
['bar', '', false, false]], | ||
what: 'Two unassigned values' | ||
}, | ||
{ source: ['foo&bar&'], | ||
expected: [['foo', undefined, false, false], | ||
['bar', undefined, false, false]], | ||
expected: [['foo', '', false, false], | ||
['bar', '', false, false]], | ||
what: 'Two unassigned values and ampersand' | ||
@@ -102,4 +102,4 @@ }, | ||
{ source: ['foo=bar&baz=bla'], | ||
expected: [['fo', undefined, true, true], | ||
['ba', undefined, true, true]], | ||
expected: [['fo', '', true, true], | ||
['ba', '', true, true]], | ||
what: 'Limits: truncated field name and zero value limit', | ||
@@ -109,4 +109,4 @@ limits: { fieldNameSize: 2, fieldSize: 0 } | ||
{ source: ['foo=bar&baz=bla'], | ||
expected: [['', undefined, true, true], | ||
['', undefined, true, true]], | ||
expected: [['', '', true, true], | ||
['', '', true, true]], | ||
what: 'Limits: truncated zero field name and zero value limit', | ||
@@ -124,3 +124,3 @@ limits: { fieldNameSize: 0, fieldSize: 0 } | ||
{ source: ['='], | ||
expected: [['', undefined, false, false]], | ||
expected: [['', '', false, false]], | ||
what: 'Assigned value, empty name and value' | ||
@@ -127,0 +127,0 @@ }, |
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
673034
5504