Skip to content

Commit

Permalink
[fix]
Browse files Browse the repository at this point in the history
  • Loading branch information
boke0 committed Mar 14, 2021
1 parent 0ba1173 commit 9e57dda
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 7 additions & 2 deletions izanami/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ def blob(self, request):
else None
)
above = Path("/" + request.params['object']) / '../'
print(above.resolve())
readme = None
if isinstance(data, git.objects.tree.Tree):
for blob in data:
if blob.name.startswith('README'):
readme = blob.data_stream.read().decode('utf-8')
return Response.render(template, {
'repo': repo,
'current_head': head,
Expand All @@ -189,7 +193,8 @@ def blob(self, request):
'name': request.params['object'],
'data': data,
'above': str(above.resolve()),
'content': content
'content': content,
'readme': readme
})

def commit(self, request):
Expand Down
9 changes: 8 additions & 1 deletion izanami/templates/repo/blob.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h5 class='card-title'>{{ name }}</h5>
</div>
{% else %}
<h5 class='card-title'>{{ name }}/</h5>
<ul>
<ul class='list-group'>
<li class='list-group-item'>
{% if above == "/" %}
<a href='{{ url('/' + repo.name + '/tree/' + current_head) }}'>../</a>
Expand All @@ -39,5 +39,12 @@ <h5 class='card-title'>{{ name }}/</h5>
</li>
{% endfor %}
</ul>
{% if readme != None %}
<div class='card'>
<div class='card-body'>
{{ readme|markdown }}
</div>
</div>
{% endif %}
{% endif %}
{% endblock %}

0 comments on commit 9e57dda

Please sign in to comment.