diff --git a/vcsserver/scm_app.py b/vcsserver/scm_app.py --- a/vcsserver/scm_app.py +++ b/vcsserver/scm_app.py @@ -27,7 +27,7 @@ import mercurial.hgweb.hgweb_mod import webob.exc from vcsserver import pygrack, exceptions, settings, git_lfs -from vcsserver.utils import ascii_bytes +from vcsserver.utils import ascii_bytes, safe_bytes log = logging.getLogger(__name__) @@ -115,7 +115,10 @@ def make_hg_ui_from_config(repo_config): baseui._tcfg = mercurial.config.config() for section, option, value in repo_config: - baseui.setconfig(ascii_bytes(section), ascii_bytes(option), ascii_bytes(value)) + baseui.setconfig( + ascii_bytes(section, allow_bytes=True), + ascii_bytes(option, allow_bytes=True), + ascii_bytes(value, allow_bytes=True)) # make our hgweb quiet so it doesn't print output baseui.setconfig(b'ui', b'quiet', b'true') @@ -131,11 +134,14 @@ def update_hg_ui_from_hgrc(baseui, repo_ return log.debug('reading hgrc from %s', path) cfg = mercurial.config.config() - cfg.read(path) + cfg.read(ascii_bytes(path)) for section in HG_UI_SECTIONS: for k, v in cfg.items(section): log.debug('settings ui from file: [%s] %s=%s', section, k, v) - baseui.setconfig(ascii_bytes(section), ascii_bytes(k), ascii_bytes(v)) + baseui.setconfig( + ascii_bytes(section, allow_bytes=True), + ascii_bytes(k, allow_bytes=True), + ascii_bytes(v, allow_bytes=True)) def create_hg_wsgi_app(repo_path, repo_name, config): @@ -151,7 +157,7 @@ def create_hg_wsgi_app(repo_path, repo_n update_hg_ui_from_hgrc(baseui, repo_path) try: - return HgWeb(repo_path, name=repo_name, baseui=baseui) + return HgWeb(safe_bytes(repo_path), name=safe_bytes(repo_name), baseui=baseui) except mercurial.error.RequirementError as e: raise exceptions.RequirementException(e)(e)