From 47c176136be6bf1c97e71595f782556e529d6259 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 02 2017 10:44:23 +0000 Subject: Fix support for namespaced projects in the doc server We have added support for namespaced projects in pagure and we need to support hosting documentation for them but we have been using the following route: @APP.route('//') This means that we are unable to distinguish between: /repo/folder/file and /namespace/repo/file This commit fixes that making the URLs be namespace.repo before listing the folder and files. This commit also adjusts the unit-tests accordingly. --- diff --git a/pagure/docs_server.py b/pagure/docs_server.py index 7129002..3e04e4a 100644 --- a/pagure/docs_server.py +++ b/pagure/docs_server.py @@ -121,18 +121,21 @@ def __get_tree_and_content(repo_obj, commit, path): @APP.route('//') -@APP.route('///') +@APP.route('/./') @APP.route('//') -@APP.route('///') +@APP.route('/./') @APP.route('/fork///') -@APP.route('/fork////') +@APP.route('/fork/.//') @APP.route('/fork///') -@APP.route('/fork////') +@APP.route('/fork/.//') def view_docs(repo, username=None, namespace=None, filename=None): """ Display the documentation """ + if '.' in repo: + namespace, repo = repo.split('.', 1) - repo = pagure.lib.get_project(SESSION, repo, user=username, namespace=namespace) + repo = pagure.lib.get_project( + SESSION, repo, user=username, namespace=namespace) if not repo: flask.abort(404, 'Project not found') diff --git a/pagure/templates/docs.html b/pagure/templates/docs.html index 9dd3453..8975ca7 100644 --- a/pagure/templates/docs.html +++ b/pagure/templates/docs.html @@ -8,16 +8,16 @@ {% block repo %} diff --git a/pagure/templates/repo_master.html b/pagure/templates/repo_master.html index 02f6a16..9c4494c 100644 --- a/pagure/templates/repo_master.html +++ b/pagure/templates/repo_master.html @@ -279,9 +279,8 @@