diff -r f106d0e629e5 -r 08612516d436 mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py Tue Dec 17 01:00:59 2024 -0500 +++ b/mercurial/hgweb/common.py Tue Dec 17 01:10:28 2024 -0500 @@ -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: