Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 节点执行报错信息跳转链接未新开tab问题修复 --bug=119961524 #7616

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading