Problem with special Characters in the URL

RĂ¼diger Kessel r.kessel at metrodata.de
Thu Aug 19 09:13:51 UTC 2021


Hi,

I was faced with an URL encoding problem which caused a
mercurial.error.ProgrammingError in mercurial/hgweb/request.py, line 276:

"PATH_INFO does not begin with repo name"

The root cause of the encoding problem is the fact that the wsgi encodes
the URL in 'iso-8859-1' but it is in fact utf-8 encoded. It is connected
with the use of Python 3.

kallithea/controllers/base.py provides the function which can return the
correct path info (get_path_info(environ)).

So one solution is to patch the environ['PATH_INFO'] with the correct
bytestring in BaseVCSController.__call__() using the following patch:

--- a/kallithea/controllers/base.py     Thu May 27 21:33:45 2021 +0200
+++ b/kallithea/controllers/base.py     Thu Aug 19 10:35:16 2021 +0200
@@ -330,6 +330,7 @@
                 log.info('%s action on %s repo "%s" by "%s" from %s',
                          parsed_request.action, self.scm_alias,
parsed_request.repo_name, user.username, ip_addr)
                 app = self._make_app(parsed_request)
+                environ['PATH_INFO']=get_path_info(environ)
                 return app(environ, start_response)
             except Exception:
                 log.error(traceback.format_exc())

I have only tested the patch using linux clients. So a test using Windows
clients might be feasible.

/RĂ¼diger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20210819/393f9d09/attachment.html>


More information about the kallithea-general mailing list