Skip to content
Snippets Groups Projects
Commit 08612516 authored by Matt Harbison's avatar Matt Harbison
Browse files

hgweb: replace a trivial file read with the `util` function

Not sure why there's an `os.stat()` here- I'd expect any errors that it might
hit to also be hit by attempting to open the file in read mode.  It goes all the
way back to a9343f9d7365 in 2006, and mentions making things more secure, so
I'll leave it be for now.
parent f106d0e6
No related branches found
No related tags found
2 merge requests!1292Draft: 7.0rc preparation,!1177Fix a bunch of potential file descriptor leaks
......@@ -219,8 +219,7 @@
path = os.path.join(directory, fpath)
try:
os.stat(path)
with open(path, 'rb') as fh:
data = fh.read()
data = util.readfile(path)
except TypeError:
raise ErrorResponse(HTTP_SERVER_ERROR, b'illegal filename')
except OSError as err:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment