diff --git a/progit/app.py b/progit/app.py index a3aeb96..f897c9b 100644 --- a/progit/app.py +++ b/progit/app.py @@ -280,10 +280,13 @@ def view_log(repo, branchname=None): def view_file(repo, identifier, filename): """ Displays the content of a file or a tree for the specified repo. """ - reponame = os.path.join(APP.config['GIT_FOLDER'], repo) - if not os.path.exists(reponame): + repo = progit.lib.get_project(SESSION, repo) + + if repo is None: flask.abort(404) - repo_obj = pygit2.Repository(reponame) + + repo_obj = pygit2.Repository(os.path.join(APP.config["GIT_FOLDER"], + repo.path)) if identifier in repo_obj.listall_branches(): branchname = identifier diff --git a/progit/templates/file.html b/progit/templates/file.html index 15c2466..d149b63 100644 --- a/progit/templates/file.html +++ b/progit/templates/file.html @@ -8,19 +8,19 @@

{% if '/fork/' in request.url %} - + {% else %} - + {% endif %} - {{ repo.split('.git')[0] }} + {{ repo.name }} : {% if '/fork/' in request.url %} + repo=repo.name, identifier=branchname) }}"> {% else %} + repo=repo.name, identifier=branchname) }}"> {% endif %} {{ branchname }}/{% for file in filename.split('/') %} @@ -32,12 +32,12 @@ {% if loop.index != loop.length %} {% if '/fork/' in request.url %}{{ file }}/ {% else %}{{ file }}/{% endif %}{% else %} @@ -61,11 +61,11 @@ else %} {% else %} {% endif %}