Escape HTML on error, misc changes

This commit is contained in:
Fierelier 2021-03-20 18:39:54 +01:00
parent 2a01cec73b
commit f3425dd93f
2 changed files with 5 additions and 6 deletions

View File

@ -27,6 +27,7 @@ from qtpy.QtMultimedia import QSound
import configparser
import json
import time
import html
browserWindows = []
os.chdir(sp)
@ -158,6 +159,7 @@ class browserWindow(QMainWindow):
self.update()
#print(prettyJson(response["headers"]))
except Exception as e:
self.cDoc.cRenderHtml(html.escape(str(e)))
self.cDoc.cRenderHtml(str(e))
raise

View File

@ -1,8 +1,5 @@
global HTMLParser
from html.parser import HTMLParser
global html
import html
import html.parser
global browserDoc
class browserDoc(QTextBrowser):
@ -19,9 +16,9 @@ class browserDoc(QTextBrowser):
self.setStyleSheet("QTextBrowser { " +style+ " }")
self.anchorClicked.connect(self.cAnchorClicked)
class cHtmlParser(HTMLParser):
class cHtmlParser(html.parser.HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
html.parser.HTMLParser.__init__(self)
self.output = ""
self.voidElements = ["area","base","br","col","hr","img","input","link","meta","param","command","keygen","source"]
self.blackList = ["img","script","style"]