修改跨站脚本攻击缺陷

This commit is contained in:
范强强
2024-03-20 09:20:06 +08:00
parent 704692fb3e
commit 1e2d2b9a9b
+1 -28
View File
@@ -385,19 +385,6 @@ export const JeroListMixin = {
modalLoading.destroy()
})
},
htmlspecialchars (string) {
var entityMap = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
'/': '&#x2F;'
}
return String(string).replace(/[&<>"'\/]/g, function (s) {
return entityMap[s]
})
},
/* 导入 */
handleImportExcel (info) {
// 限制导入大于500MB
@@ -427,21 +414,7 @@ export const JeroListMixin = {
importModalLoading && importModalLoading.destroy()
this.loading = false
if (info.file.response.success) {
// this.$message.success(`${info.file.name} 文件上传成功`);
if (info.file.response.code === 201) {
const { message, result: { msg, fileUrl, fileName } } = info.file.response
const href = this.htmlspecialchars(window._CONFIG.domianURL + fileUrl)
this.$warning({
title: message,
content: (<div>
<span>{msg}</span><br />
<span>具体详情请 <a rel="nofollow noopener noreferrer" href={href} target="_blank" download={fileName}>点击下载</a> </span>
</div>
)
})
} else {
this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
}
this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
this.loadData()
} else {
if (Array.isArray(info.file.response.result) && info.file.response.result.length > 0) {