##// END OF EJS Templates
indexing: fixed problems with non-ascii files indexing.
marcink -
r4340:585018bb default
parent child
Show More
@@ -33,7 +33,7 from rhodecode.lib import audit_logger,
33 from rhodecode.lib import repo_maintenance
33 from rhodecode.lib import repo_maintenance
34 from rhodecode.lib.auth import HasPermissionAnyApi, HasUserGroupPermissionAnyApi
34 from rhodecode.lib.auth import HasPermissionAnyApi, HasUserGroupPermissionAnyApi
35 from rhodecode.lib.celerylib.utils import get_task_id
35 from rhodecode.lib.celerylib.utils import get_task_id
36 from rhodecode.lib.utils2 import str2bool, time_to_datetime, safe_str, safe_int
36 from rhodecode.lib.utils2 import str2bool, time_to_datetime, safe_str, safe_int, safe_unicode
37 from rhodecode.lib.ext_json import json
37 from rhodecode.lib.ext_json import json
38 from rhodecode.lib.exceptions import StatusChangeOnClosedPullRequestError
38 from rhodecode.lib.exceptions import StatusChangeOnClosedPullRequestError
39 from rhodecode.lib.vcs import RepositoryError
39 from rhodecode.lib.vcs import RepositoryError
@@ -573,6 +573,7 def get_repo_file(request, apiuser, repo
573 elif details == 'full':
573 elif details == 'full':
574 extended_info = content = True
574 extended_info = content = True
575
575
576 file_path = safe_unicode(file_path)
576 try:
577 try:
577 # check if repo is not empty by any chance, skip quicker if it is.
578 # check if repo is not empty by any chance, skip quicker if it is.
578 _scm = repo.scm_instance()
579 _scm = repo.scm_instance()
@@ -583,12 +584,12 def get_repo_file(request, apiuser, repo
583 repo, commit_id, file_path, extended_info=extended_info,
584 repo, commit_id, file_path, extended_info=extended_info,
584 content=content, max_file_bytes=max_file_bytes, cache=cache)
585 content=content, max_file_bytes=max_file_bytes, cache=cache)
585 except NodeDoesNotExistError:
586 except NodeDoesNotExistError:
586 raise JSONRPCError('There is no file in repo: `{}` at path `{}` for commit: `{}`'.format(
587 raise JSONRPCError(u'There is no file in repo: `{}` at path `{}` for commit: `{}`'.format(
587 repo.repo_name, file_path, commit_id))
588 repo.repo_name, file_path, commit_id))
588 except Exception:
589 except Exception:
589 log.exception("Exception occurred while trying to get repo %s file",
590 log.exception(u"Exception occurred while trying to get repo %s file",
590 repo.repo_name)
591 repo.repo_name)
591 raise JSONRPCError('failed to get repo: `{}` file at path {}'.format(
592 raise JSONRPCError(u'failed to get repo: `{}` file at path {}'.format(
592 repo.repo_name, file_path))
593 repo.repo_name, file_path))
593
594
594 return node
595 return node
General Comments 0
You need to be logged in to leave comments. Login now