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