files: fixed rendering of readme files under non-ascii paths.

This commit is contained in:
Marcin Kuzminski 2019-06-14 11:42:05 +02:00
parent cdbfcd99f7
commit 7d97198330
3 changed files with 7 additions and 3 deletions

View file

@ -72,6 +72,7 @@ class RepoSummaryView(RepoAppView):
log.debug("Searching for a README file.")
readme_node = ReadmeFinder(_renderer_type).search(commit)
if readme_node:
log.debug('Found README node: %s', readme_node)
relative_urls = {
'raw': h.route_path(
'repo_file_raw', repo_name=_repo_name,
@ -82,7 +83,8 @@ class RepoSummaryView(RepoAppView):
}
readme_data = self._render_readme_or_none(
commit, readme_node, relative_urls)
readme_filename = readme_node.path
readme_filename = readme_node.unicode_path
return readme_data, readme_filename
inv_context_manager = rc_cache.InvalidationContext(

View file

@ -219,7 +219,7 @@ class _ToolTip(object):
tooltip = _ToolTip()
files_icon = icon = '<i class="file-breadcrumb-copy tooltip icon-clipboard clipboard-action" data-clipboard-text="{}" title="Copy the full path"></i>'
files_icon = u'<i class="file-breadcrumb-copy tooltip icon-clipboard clipboard-action" data-clipboard-text="{}" title="Copy the full path"></i>'
def files_breadcrumbs(repo_name, commit_id, file_path, at_ref=None, limit_items=False, linkify_last_item=False):

View file

@ -35,7 +35,9 @@
<div class="box">
<div class="title" title="${h.tooltip(_('Readme file from commit %s:%s') % (c.rhodecode_db_repo.landing_rev[0], c.rhodecode_db_repo.landing_rev[1]))}">
<h3 class="breadcrumbs">
<a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_rev[1],f_path=c.readme_file)}">${c.readme_file}</a>
<a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_rev[1],f_path=c.readme_file)}">
${c.readme_file}
</a>
</h3>
</div>
<div class="readme codeblock">