Commit 76585817 authored by Raymond Hettinger's avatar Raymond Hettinger

SF bug #902037: relative on-disk SYSTEM id handling is incorrect

(Contributed by Bob Ippolito.)

backport candidate.
parent 38946e4c
...@@ -283,10 +283,11 @@ def prepare_input_source(source, base = ""): ...@@ -283,10 +283,11 @@ def prepare_input_source(source, base = ""):
if source.getByteStream() is None: if source.getByteStream() is None:
sysid = source.getSystemId() sysid = source.getSystemId()
if os.path.isfile(sysid): basehead = os.path.split(os.path.normpath(base))[0]
basehead = os.path.split(os.path.normpath(base))[0] sysidfilename = os.path.join(basehead, sysid)
source.setSystemId(os.path.join(basehead, sysid)) if os.path.isfile(sysidfilename):
f = open(sysid, "rb") source.setSystemId(sysidfilename)
f = open(sysidfilename, "rb")
else: else:
source.setSystemId(urlparse.urljoin(base, sysid)) source.setSystemId(urlparse.urljoin(base, sysid))
f = urllib.urlopen(source.getSystemId()) f = urllib.urlopen(source.getSystemId())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment