-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ var util = require('./util'), | |
Stream = require('stream').Stream; | ||
|
||
function IncomingForm(opts) { | ||
if (!(this instanceof IncomingForm)) return new IncomingForm; | ||
if (!(this instanceof IncomingForm)) return new IncomingForm(opts); | ||
EventEmitter.call(this); | ||
|
||
opts=opts||{}; | ||
|
@@ -33,6 +33,7 @@ function IncomingForm(opts) { | |
this._parser = null; | ||
this._flushing = 0; | ||
this._fieldsSize = 0; | ||
return this; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
felixge
|
||
}; | ||
util.inherits(IncomingForm, EventEmitter); | ||
exports.IncomingForm = IncomingForm; | ||
|
@@ -336,7 +337,7 @@ IncomingForm.prototype._initMultipart = function(boundary) { | |
}; | ||
|
||
IncomingForm.prototype._fileName = function(headerValue) { | ||
var m = headerValue.match(/filename="(.*?)"($|; )/i) | ||
var m = headerValue.match(/filename="(.*?)"($|; )/i); | ||
if (!m) return; | ||
|
||
var filename = m[1].substr(m[1].lastIndexOf('\\') + 1); | ||
|
@@ -373,7 +374,7 @@ IncomingForm.prototype._uploadPath = function(filename) { | |
|
||
if (this.keepExtensions) { | ||
var ext = path.extname(filename); | ||
ext = ext.replace(/(\.[a-z0-9]+).*/, '$1') | ||
ext = ext.replace(/(\.[a-z0-9]+).*/, '$1'); | ||
|
||
name += ext; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,13 +13,13 @@ var Buffer = require('buffer').Buffer, | |
PART_DATA_START: s++, | ||
PART_DATA: s++, | ||
PART_END: s++, | ||
END: s++, | ||
END: s++ | ||
}, | ||
This comment has been minimized.
Sorry, something went wrong.
felixge
|
||
|
||
f = 1, | ||
F = | ||
{ PART_BOUNDARY: f, | ||
LAST_BOUNDARY: f *= 2, | ||
LAST_BOUNDARY: f *= 2 | ||
}, | ||
|
||
LF = 10, | ||
|
@@ -34,7 +34,7 @@ var Buffer = require('buffer').Buffer, | |
return c | 0x20; | ||
}; | ||
|
||
for (var s in S) { | ||
for (s in S) { | ||
exports[s] = S[s]; | ||
} | ||
|
||
|
@@ -207,7 +207,7 @@ MultipartParser.prototype.write = function(buffer) { | |
state = S.PART_DATA_START; | ||
break; | ||
case S.PART_DATA_START: | ||
state = S.PART_DATA | ||
state = S.PART_DATA; | ||
mark('partData'); | ||
case S.PART_DATA: | ||
prevIndex = index; | ||
|
Why? That's implicit in JS, no?