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

Skip to content

Commit 06d9b1f

Browse files
committed
SF bug #902037: relative on-disk SYSTEM id handling is incorrect
(Contributed by Bob Ippolito.) backport candidate.
1 parent e54e726 commit 06d9b1f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Lib/xml/sax/saxutils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,11 @@ def prepare_input_source(source, base = ""):
283283

284284
if source.getByteStream() is None:
285285
sysid = source.getSystemId()
286-
if os.path.isfile(sysid):
287-
basehead = os.path.split(os.path.normpath(base))[0]
288-
source.setSystemId(os.path.join(basehead, sysid))
289-
f = open(sysid, "rb")
286+
basehead = os.path.split(os.path.normpath(base))[0]
287+
sysidfilename = os.path.join(basehead, sysid)
288+
if os.path.isfile(sysidfilename):
289+
source.setSystemId(sysidfilename)
290+
f = open(sysidfilename, "rb")
290291
else:
291292
source.setSystemId(urlparse.urljoin(base, sysid))
292293
f = urllib.urlopen(source.getSystemId())

0 commit comments

Comments
 (0)