jssdk 文件下载判断优化 (#1319)

* 优化文件下载

* 优化文件下载
This commit is contained in:
liaoxuezhi 2021-01-04 23:37:25 +08:00 committed by GitHub
parent ebbc1fb67d
commit 32e04a2b96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,7 +46,7 @@ export function embed(
const disposition = response.headers['content-disposition'];
let filename = '';
if (disposition && disposition.indexOf('attachment') !== -1) {
let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/i;
let matches = filenameRegex.exec(disposition);
if (matches != null && matches[1]) {
filename = matches[1].replace(/['"]/g, '');