Skip to content

Commit

Permalink
Merge pull request #1505 from simov/fix-multipart-boundary
Browse files Browse the repository at this point in the history
Fix multipart boundary extraction regexp
  • Loading branch information
simov committed Mar 27, 2015
2 parents 2d95c75 + fd545b3 commit 5b03774
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/multipart.js
Expand Up @@ -56,7 +56,7 @@ Multipart.prototype.setHeaders = function (chunked) {
self.request.setHeader('content-type', 'multipart/related; boundary=' + self.boundary)
} else {
if (header.indexOf('boundary') !== -1) {
self.boundary = header.replace(/.*boundary=([^\s;])+.*/, '$1')
self.boundary = header.replace(/.*boundary=([^\s;]+).*/, '$1')
} else {
self.request.setHeader('content-type', header + '; boundary=' + self.boundary)
}
Expand Down
4 changes: 2 additions & 2 deletions tests/test-multipart.js
Expand Up @@ -59,8 +59,8 @@ function runTest(t, a) {
// check for http://localhost:6767/file traces
t.ok(data.indexOf('Photoshop ICC') !== -1)

if (a.header && a.header.indexOf('mixed') !== -1) {
t.ok(data.indexOf('boundary=XXX'))
if (a.header && a.header.indexOf('boundary=XXX') !== -1) {
t.ok(data.indexOf('--XXX') !== -1)
}

res.writeHead(200)
Expand Down

0 comments on commit 5b03774

Please sign in to comment.