diff --git a/rhodecode/api/views/repo_api.py b/rhodecode/api/views/repo_api.py --- a/rhodecode/api/views/repo_api.py +++ b/rhodecode/api/views/repo_api.py @@ -33,7 +33,7 @@ from rhodecode.lib import audit_logger, 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, repo 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, repo 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