diff --git a/vcsserver/base.py b/vcsserver/base.py --- a/vcsserver/base.py +++ b/vcsserver/base.py @@ -24,7 +24,7 @@ from vcsserver.lib.rc_cache import regio from vcsserver import exceptions from vcsserver.exceptions import NoContentException -from vcsserver.hgcompat import (archival) +from vcsserver.hgcompat import archival from vcsserver.str_utils import safe_bytes log = logging.getLogger(__name__) @@ -101,16 +101,17 @@ def archive_repo(walker, archive_dest_pa yield ArchiveNode(fn, mode, is_link, ctx[fn].data) """ extra_metadata = extra_metadata or {} + archive_dest_path = safe_bytes(archive_dest_path) if kind == "tgz": - archiver = archival.tarit(archive_dest_path, mtime, "gz") + archiver = archival.tarit(archive_dest_path, mtime, b"gz") elif kind == "tbz2": - archiver = archival.tarit(archive_dest_path, mtime, "bz2") + archiver = archival.tarit(archive_dest_path, mtime, b"bz2") elif kind == 'zip': archiver = archival.zipit(archive_dest_path, mtime) else: raise exceptions.ArchiveException()( - 'Remote does not support: "%s" archive type.' % kind) + f'Remote does not support: "{kind}" archive type.') for f in walker(commit_id, archive_at_path): f_path = os.path.join(safe_bytes(archive_dir_name), f.path.lstrip(b'/'))