Add some hardening against non-generated layouts

This commit is contained in:
Pieter Vander Vennet 2024-07-19 17:12:31 +02:00
parent 5bb6a6bf63
commit 1853af06a0
3 changed files with 38 additions and 7 deletions

View file

@ -806,6 +806,9 @@ class LayerOverviewUtils extends Script {
try {
ScriptUtils.ReadSvgSync(themeFile.icon, (svg) => {
const width: string = svg["$"].width
if (width === undefined) {
throw "The logo at " + themeFile.icon + " does not have a defined width"
}
const height: string = svg["$"].height
const err = themeFile.hideFromOverview ? console.warn : console.error
if (width !== height) {
@ -815,6 +818,11 @@ class LayerOverviewUtils extends Script {
err(e)
}
if (width?.endsWith("%")) {
throw "The logo at " + themeFile.icon + " has a relative width; this is not supported"
}
const w = parseInt(width)
const h = parseInt(height)
if (w < 370 || h < 370) {