Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 07c81d9

Browse files
committed
Prevent creating a HTML link to file://?/
1 parent fbff1bc commit 07c81d9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Lib/cgitb.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,11 @@ def html((etype, evalue, etb), context=5):
112112
frames = []
113113
records = inspect.getinnerframes(etb, context)
114114
for frame, file, lnum, func, lines, index in records:
115-
file = file and os.path.abspath(file) or '?'
116-
link = '<a href="file://%s">%s</a>' % (file, pydoc.html.escape(file))
115+
if file:
116+
file = os.path.abspath(file)
117+
link = '<a href="file://%s">%s</a>' % (file, pydoc.html.escape(file))
118+
else:
119+
file = link = '?'
117120
args, varargs, varkw, locals = inspect.getargvalues(frame)
118121
call = ''
119122
if func != '?':

0 commit comments

Comments
 (0)