修复文件上传时文件名读取错误的问题
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yizhi-multipart-reader",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"types": "typing/index.d.ts",
|
||||
|
@ -284,8 +284,9 @@ export class MultipartReader {
|
||||
if (key == 'content-disposition') {
|
||||
const items = val.split(/;/).map(s => s.trim()).filter(s => !!s)
|
||||
items.forEach(item => {
|
||||
let [k, v] = item.split(/=/)
|
||||
if (!v) return
|
||||
const matchItem = item.match(/^([\s\S]+?)=([\s\S]+?)$/)
|
||||
if (!matchItem) return
|
||||
let [k, v] = matchItem.map(s => s.trim())
|
||||
k = k.toLowerCase()
|
||||
//去除引号
|
||||
if (v[0] == '"' && v[v.length - 1] == '"') v = v.substring(1, v.length - 1)
|
||||
|
Reference in New Issue
Block a user