From 45e1319067731d83b8989567528e8f0591fd4073 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 5 Apr 2017 14:29:46 -0400 Subject: [PATCH] Properly redirect to app repository URLs --- endpoints/web.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/endpoints/web.py b/endpoints/web.py index e5ec62eab..67eb5feb9 100644 --- a/endpoints/web.py +++ b/endpoints/web.py @@ -703,11 +703,14 @@ def redirect_to_repository(namespace_name, repo_name, tag_name): # Redirect to the repository page if the user can see the repository. is_public = model.repository.repository_is_public(namespace_name, repo_name) permission = ReadRepositoryPermission(namespace_name, repo_name) - repo_exists = bool(model.repository.get_repository(namespace_name, repo_name)) + repo = model.repository.get_repository(namespace_name, repo_name) - if repo_exists and (permission.can() or is_public): + if repo and (permission.can() or is_public): repo_path = '/'.join([namespace_name, repo_name]) - return redirect(url_for('web.repository', path=repo_path, tab="tags", tag=tag_name)) + if repo.kind.name == 'application': + return redirect(url_for('web.application', path=repo_path)) + else: + return redirect(url_for('web.repository', path=repo_path, tab="tags", tag=tag_name)) namespace_exists = bool(model.user.get_user_or_org(namespace_name)) namespace_permission = OrganizationMemberPermission(namespace_name).can()