mirror of
https://github.com/openstf/stf
synced 2025-10-04 10:19:30 +02:00
fix: chinese characters donot support
This commit is contained in:
parent
e346700708
commit
371ee429e1
1 changed files with 5 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
var http = require('http')
|
||||
var util = require('util')
|
||||
var path = require('path')
|
||||
var crypto = require('crypto');
|
||||
|
||||
var express = require('express')
|
||||
var validator = require('express-validator')
|
||||
|
@ -89,6 +90,10 @@ module.exports = function(options) {
|
|||
if (options.saveDir) {
|
||||
form.uploadDir = options.saveDir
|
||||
}
|
||||
form.on ('fileBegin', function(name, file){
|
||||
var md5 = crypto.createHash('md5')
|
||||
file.name = md5.update(file.name).digest('hex')
|
||||
})
|
||||
Promise.promisify(form.parse, form)(req)
|
||||
.spread(function(fields, files) {
|
||||
return Object.keys(files).map(function(field) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue