We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ac89c44 + 4cf6b7e commit 34fd04dCopy full SHA for 34fd04d
1 file changed
lib/incoming_form.js
@@ -1,5 +1,6 @@
1
if (global.GENTLY) require = GENTLY.hijack(require);
2
3
+var crypto = require('crypto');
4
var fs = require('fs');
5
var util = require('util'),
6
path = require('path'),
@@ -528,9 +529,10 @@ IncomingForm.prototype._initJSONencoded = function() {
528
529
};
530
531
IncomingForm.prototype._uploadPath = function(filename) {
- var name = '';
532
- for (var i = 0; i < 32; i++) {
533
- name += Math.floor(Math.random() * 16).toString(16);
+ var name = 'upload_';
+ var buf = crypto.randomBytes(16);
534
+ for (var i = 0; i < buf.length; ++i) {
535
+ name += ('0' + buf[i].toString(16)).slice(-2);
536
}
537
538
if (this.keepExtensions) {
0 commit comments