changeset 13400 | 14f3795a5ed7 |
parent 12183 | f64b416b0ac8 |
child 13444 | 75f5f312df5f |
--- a/mercurial/hgweb/common.py Fri Feb 11 22:24:10 2011 +0800 +++ b/mercurial/hgweb/common.py Fri Dec 24 15:23:01 2010 +0100 @@ -119,7 +119,10 @@ os.stat(path) ct = mimetypes.guess_type(path)[0] or "text/plain" req.respond(HTTP_OK, ct, length = os.path.getsize(path)) - return open(path, 'rb').read() + fp = open(path, 'rb') + data = fp.read() + fp.close() + return data except TypeError: raise ErrorResponse(HTTP_SERVER_ERROR, 'illegal filename') except OSError, err: