Mercurial > kallithea
changeset 5617:964aa663deca stable
repos: fix crashes when repository name is unicode and can't be encoded with the current LANG
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 05 Jan 2016 16:24:27 +0100 |
parents | 890189aa2bfe |
children | 82ed7ad0dc48 72cd2748da02 |
files | kallithea/model/db.py kallithea/model/repo.py |
diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/model/db.py Tue Jan 05 16:24:23 2016 +0100 +++ b/kallithea/model/db.py Tue Jan 05 16:24:27 2016 +0100 @@ -1458,7 +1458,7 @@ def __get_instance(self): repo_full_path = self.repo_full_path - alias = get_scm(repo_full_path)[0] + alias = get_scm(safe_str(repo_full_path))[0] log.debug('Creating instance of %s repository from %s', alias, repo_full_path) backend = get_backend(alias)
--- a/kallithea/model/repo.py Tue Jan 05 16:24:23 2016 +0100 +++ b/kallithea/model/repo.py Tue Jan 05 16:24:27 2016 +0100 @@ -742,8 +742,8 @@ """ log.info('renaming repo from %s to %s', old, new) - old_path = os.path.join(self.repos_path, old) - new_path = os.path.join(self.repos_path, new) + old_path = safe_str(os.path.join(self.repos_path, old)) + new_path = safe_str(os.path.join(self.repos_path, new)) if os.path.isdir(new_path): raise Exception( 'Was trying to rename to already existing dir %s' % new_path @@ -758,7 +758,7 @@ :param repo: repo object """ - rm_path = os.path.join(self.repos_path, repo.repo_name) + rm_path = safe_str(os.path.join(self.repos_path, repo.repo_name)) log.info("Removing %s", rm_path) _now = datetime.now() @@ -768,4 +768,4 @@ if repo.group: args = repo.group.full_path_splitted + [_d] _d = os.path.join(*args) - shutil.move(rm_path, os.path.join(self.repos_path, _d)) + shutil.move(rm_path, safe_str(os.path.join(self.repos_path, _d)))