polybar: sanitize a bit more untrusted inputs

This commit is contained in:
Vincent Bernat 2021-12-19 12:36:00 +01:00
parent eb55cf3e84
commit 2fdafc8d3a
2 changed files with 2 additions and 1 deletions

View file

@ -950,7 +950,7 @@ async def network_manager_status(i3, event, *args):
state = await nma.State state = await nma.State
if state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED: if state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED:
status.append(icons["vpn"]) status.append(icons["vpn"])
status.append(await nma.Id) status.append((await nma.Id).replace("%", "%%"))
# Final status line # Final status line
return " ".join(status) return " ".join(status)

View file

@ -177,6 +177,7 @@ if __name__ == "__main__":
round(weather["daily"][0]["temp"]["max"]), round(weather["daily"][0]["temp"]["max"]),
), ),
] ]
city = city.replace('%', '%%')
conditions.insert(0, f"%{{F#888}}%{{Tx}}%{{T-}} {city}%{{F-}}") conditions.insert(0, f"%{{F#888}}%{{Tx}}%{{T-}} {city}%{{F-}}")
output = " ".join(conditions).replace("%{Tx}", "%%{T%d}" % options.font_index) output = " ".join(conditions).replace("%{Tx}", "%%{T%d}" % options.font_index)
logger.debug("output: %s", output) logger.debug("output: %s", output)