From 9e57dda3ba1e6fdbe23cae7d425d247414c70e8f Mon Sep 17 00:00:00 2001 From: boke0 Date: Sun, 14 Mar 2021 13:15:47 +0900 Subject: [PATCH] [fix] --- izanami/controller.py | 9 +++++++-- izanami/templates/repo/blob.html | 9 ++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/izanami/controller.py b/izanami/controller.py index 9f8a3cc..cbb149a 100644 --- a/izanami/controller.py +++ b/izanami/controller.py @@ -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, @@ -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): diff --git a/izanami/templates/repo/blob.html b/izanami/templates/repo/blob.html index cfa56b3..f59f907 100644 --- a/izanami/templates/repo/blob.html +++ b/izanami/templates/repo/blob.html @@ -25,7 +25,7 @@
{{ name }}
{% else %}
{{ name }}/
-