Skip to content

Commit

Permalink
fix code scanning security warning #1 and #2
Browse files Browse the repository at this point in the history
  • Loading branch information
s-tittel committed Jan 10, 2024
1 parent 46aa437 commit e824025
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export abstract class Theme {
}
viewer.appendChild(labelElem)
let name = value.value
let lang: HTMLElement | null = null
if (value instanceof NamedNode) {
const quads = template.config.shapesGraph.getQuads(name, null, null, SHAPES_GRAPH)
if (quads.length) {
Expand All @@ -43,7 +44,9 @@ export abstract class Theme {
}
} else if (value instanceof Literal) {
if (value.language) {
name += '<span class="lang">@' + value.language + '</span>'
lang = document.createElement('span')
lang.classList.add('lang')
lang.innerText = `@${value.language}`
} else if (value.datatype.value === `${PREFIX_XSD}date`) {
name = new Date(Date.parse(value.value)).toDateString()
} else if (value.datatype.value === `${PREFIX_XSD}dateTime`) {
Expand All @@ -58,7 +61,10 @@ export abstract class Theme {
valueElem = document.createElement('div')
}
valueElem.classList.add('d-flex')
valueElem.innerHTML = name
valueElem.innerText = name
if (lang) {
valueElem.appendChild(lang)
}
viewer.appendChild(valueElem)
return viewer
}
Expand Down

0 comments on commit e824025

Please sign in to comment.