Skip to content

Commit

Permalink
fix: 节点执行报错信息跳转链接未新开tab问题修复 --bug=119961524
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 24302
  • Loading branch information
ywywZhou authored and luofann committed Nov 20, 2024
1 parent 30968c0 commit 09eb0f1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
13 changes: 8 additions & 5 deletions frontend/desktop/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import locales from 'element-ui/lib/locale'
import { STRING_LENGTH } from '@/constants/index.js'
import cron from '@/assets/js/node-cron-valid/node-cron-vaild.js'
import tools from './utils/tools'
const config = {
errorBagName: 'veeErrors',
fieldsBagName: 'veeFields'
Expand Down Expand Up @@ -212,11 +213,13 @@ Validator.localize({
}
})

Vue.prototype.filterXSS = input => filterXSS(input, {
whiteList: {
a: ['href']
}
})
Vue.prototype.filterXSS = (input, config = {}) => {
return filterXSS(input, tools.deepMerge({}, {
whiteList: {
a: ['href', 'target']
}
}, config))
}

new Vue({
i18n,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@
let info = data.replace(/\n/g, '<br>')
info = this.filterXSS(info, {
whiteList: {
a: ['href'],
br: []
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,6 @@
let info = data.replace(/\n/g, '<br>')
info = this.filterXSS(info, {
whiteList: {
a: ['href'],
br: []
}
})
Expand Down
21 changes: 21 additions & 0 deletions frontend/desktop/src/utils/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,28 @@ const tools = {
}
}
return arr.join(':')
},
// 深合并
deepMerge (target, ...sources) {
if (!isObject(target)) return target

sources.forEach(source => {
if (isObject(source)) {
Object.keys(source).forEach(key => {
if (isObject(source[key])) {
if (!target[key]) Object.assign(target, { [key]: {} })
tools.deepMerge(target[key], source[key])
} else {
Object.assign(target, { [key]: source[key] })
}
})
}
})

return target
}
}

const isObject = item => item && typeof item === 'object' && !Array.isArray(item)

export default tools

0 comments on commit 09eb0f1

Please sign in to comment.