diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c8630f5..247f18c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -5,6 +5,7 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
+ merge_group:
jobs:
Job:
@@ -12,6 +13,6 @@ jobs:
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest, macos-latest'
- version: '14, 16, 18, 20, 22'
+ version: '14, 16, 18, 20, 22, 24'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
diff --git a/README.md b/README.md
index 4fb0e34..df93069 100644
--- a/README.md
+++ b/README.md
@@ -204,14 +204,8 @@ See [Node.js Documentation](http://nodejs.org/api/stream.html#stream_event_end)
[MIT](LICENSE)
-
-
## Contributors
-|[
fengmk2](https://github.com/fengmk2)
|[
xingrz](https://github.com/xingrz)
|[
semantic-release-bot](https://github.com/semantic-release-bot)
|[
fjc0k](https://github.com/fjc0k)
|[
mrspeiser](https://github.com/mrspeiser)
|[
dead-horse](https://github.com/dead-horse)
|
-| :---: | :---: | :---: | :---: | :---: | :---: |
-[
shaozj](https://github.com/shaozj)
-
-This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Wed May 15 2024 00:34:12 GMT+0800`.
+[](https://github.com/node-modules/formstream/graphs/contributors)
-
+Made with [contributors-img](https://contrib.rocks).
diff --git a/lib/formstream.js b/lib/formstream.js
index fb47b4a..ed2de6e 100644
--- a/lib/formstream.js
+++ b/lib/formstream.js
@@ -35,6 +35,7 @@ Content-Type: image/png\r\n
var debug = require('util').debuglog('formstream');
var Stream = require('stream');
+var crypto = require('crypto');
var parseStream = require('pause-stream');
var util = require('util');
var mime = require('mime');
@@ -71,15 +72,8 @@ util.inherits(FormStream, Stream);
module.exports = FormStream;
FormStream.prototype._generateBoundary = function() {
- // https://github.com/felixge/node-form-data/blob/master/lib/form_data.js#L162
- // This generates a 50 character boundary similar to those used by Firefox.
- // They are optimized for boyer-moore parsing.
- var boundary = '--------------------------';
- for (var i = 0; i < 24; i++) {
- boundary += Math.floor(Math.random() * 10).toString(16);
- }
-
- return boundary;
+ // https://github.com/form-data/form-data/blob/16e00765342106876f98a1c9703314006c9e937a/lib/form_data.js#L345
+ return '--------------------------' + crypto.randomBytes(12).toString('hex');
};
FormStream.prototype.setTotalStreamSize = function (size) {
diff --git a/package.json b/package.json
index dee5b7c..f966346 100644
--- a/package.json
+++ b/package.json
@@ -13,8 +13,7 @@
"cov": "egg-bin cov",
"ci": "npm run lint && npm run tsd && npm run cov && NODE_DEBUG=formstream npm run cov",
"lint": "jshint .",
- "tsd": "tsd",
- "contributor": "git-contributor"
+ "tsd": "tsd"
},
"repository": {
"type": "git",
@@ -40,7 +39,6 @@
"connect-multiparty": "1",
"egg-bin": "^5.6.1",
"express": "^4.16.4",
- "git-contributor": "^2.1.5",
"jshint": "^2.13.6",
"pedding": "1",
"should": "4",
diff --git a/test/formstream.test.js b/test/formstream.test.js
index 4a68cfd..d9b0252 100644
--- a/test/formstream.test.js
+++ b/test/formstream.test.js
@@ -246,7 +246,7 @@ describe('formstream.test.js', function () {
pwd: '哈哈pwd'
});
data.headers.should.have.property('content-type')
- .with.match(/multipart\/form-data; boundary=--------------------------\d{24}/);
+ .with.match(/multipart\/form-data; boundary=--------------------------\w{24}/);
var files = data.files;
files.should.have.keys('stream1', 'stream2', 'file');
var stream1 = files.stream1;
@@ -288,7 +288,7 @@ describe('formstream.test.js', function () {
pwd: '哈哈pwd'
});
data.headers.should.have.property('content-type')
- .with.match(/multipart\/form-data; boundary=--------------------------\d{24}/);
+ .with.match(/multipart\/form-data; boundary=--------------------------\w{24}/);
var files = data.files;
files.should.have.keys('stream1', 'stream2', 'file');
var stream1 = files.stream1;
@@ -323,7 +323,7 @@ describe('formstream.test.js', function () {
pwd: '哈哈pwd'
});
data.headers.should.have.property('content-type')
- .with.match(/^multipart\/form-data; boundary=--------------------------\d{24}$/);
+ .with.match(/^multipart\/form-data; boundary=--------------------------\w{24}$/);
var files = data.files;
files.should.have.keys('file', 'logo');
files.file.filename.should.equal('formstream.test.js');
@@ -351,7 +351,7 @@ describe('formstream.test.js', function () {
});
data.headers.should.have.property('content-length').with.equal(form._contentLength + '');
data.headers.should.have.property('content-type')
- .with.match(/^multipart\/form-data; boundary=--------------------------\d{24}$/);
+ .with.match(/^multipart\/form-data; boundary=--------------------------\w{24}$/);
var files = data.files;
files.should.have.keys('file', 'logo');
files.file.filename.should.equal('formstream.test.js');
@@ -448,7 +448,7 @@ describe('formstream.test.js', function () {
form.field('foo', 'bar');
var headers = form.headers({ 'X-Test': 'hello' });
headers.should.have.keys('Content-Type', 'Content-Length', 'X-Test');
- headers['Content-Type'].should.match(/^multipart\/form-data; boundary=--------------------------\d{24}$/);
+ headers['Content-Type'].should.match(/^multipart\/form-data; boundary=--------------------------\w{24}$/);
headers['X-Test'].should.equal('hello');
headers['Content-Length'].should.equal('161');
});