Skip to content

Commit

Permalink
fix #450 (escaping html char)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefal committed Jan 25, 2025
1 parent b286b1e commit 34d5157
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions web_app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import requests
import tempfile
import argparse
import html

from threading import Thread
from RTKLIB import RTKLIB
Expand Down Expand Up @@ -509,13 +510,13 @@ def diagnostic():
universal_newlines=True,
check=False)
journalctl = subprocess.run(['journalctl', '--since', '7 days ago', '-u', service['service_unit']],
stdout=subprocess.PIPE,
stdout=subprocess.PIPE,
universal_newlines=True,
check=False)

#Replace carrier return to <br> for html view
sysctl_status = sysctl_status.stdout.replace('\n', '<br>')
journalctl = journalctl.stdout.replace('\n', '<br>')
sysctl_status = html.escape(sysctl_status.stdout.replace('\n', '<br>'))
journalctl = html.escape(journalctl.stdout.replace('\n', '<br>'))
active_state = "Active" if service.get('active') == True else "Inactive"
logs.append({'name' : service['service_unit'], 'active' : active_state, 'sysctl_status' : sysctl_status, 'journalctl' : journalctl})

Expand Down

0 comments on commit 34d5157

Please sign in to comment.