From 004875e902dc2f600f080d728ff4f9fb4e766fc6 Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Wed, 13 May 2020 14:37:46 +0200 Subject: [PATCH] indexing: fixed problems with non-ascii files indexing. --- rhodecode/api/views/repo_api.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rhodecode/api/views/repo_api.py b/rhodecode/api/views/repo_api.py index 44ed6c10..34414900 100644 --- a/rhodecode/api/views/repo_api.py +++ b/rhodecode/api/views/repo_api.py @@ -33,7 +33,7 @@ from rhodecode.lib import audit_logger, rc_cache from rhodecode.lib import repo_maintenance from rhodecode.lib.auth import HasPermissionAnyApi, HasUserGroupPermissionAnyApi from rhodecode.lib.celerylib.utils import get_task_id -from rhodecode.lib.utils2 import str2bool, time_to_datetime, safe_str, safe_int +from rhodecode.lib.utils2 import str2bool, time_to_datetime, safe_str, safe_int, safe_unicode from rhodecode.lib.ext_json import json from rhodecode.lib.exceptions import StatusChangeOnClosedPullRequestError from rhodecode.lib.vcs import RepositoryError @@ -573,6 +573,7 @@ def get_repo_file(request, apiuser, repoid, commit_id, file_path, elif details == 'full': extended_info = content = True + file_path = safe_unicode(file_path) try: # check if repo is not empty by any chance, skip quicker if it is. _scm = repo.scm_instance() @@ -583,12 +584,12 @@ def get_repo_file(request, apiuser, repoid, commit_id, file_path, repo, commit_id, file_path, extended_info=extended_info, content=content, max_file_bytes=max_file_bytes, cache=cache) except NodeDoesNotExistError: - raise JSONRPCError('There is no file in repo: `{}` at path `{}` for commit: `{}`'.format( + raise JSONRPCError(u'There is no file in repo: `{}` at path `{}` for commit: `{}`'.format( repo.repo_name, file_path, commit_id)) except Exception: - log.exception("Exception occurred while trying to get repo %s file", + log.exception(u"Exception occurred while trying to get repo %s file", repo.repo_name) - raise JSONRPCError('failed to get repo: `{}` file at path {}'.format( + raise JSONRPCError(u'failed to get repo: `{}` file at path {}'.format( repo.repo_name, file_path)) return node