Commit ad56afc5a512419cf692b957e4776bb94264a259

Thomas de Grivel 2022-03-05T15:39:27

fix repository show

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/lib/kmxgit_web/controllers/repository_controller.ex b/lib/kmxgit_web/controllers/repository_controller.ex
index f730459..bb91838 100644
--- a/lib/kmxgit_web/controllers/repository_controller.ex
+++ b/lib/kmxgit_web/controllers/repository_controller.ex
@@ -100,9 +100,9 @@ defmodule KmxgitWeb.RepositoryController do
     chunks = params["slug"] |> chunk_path()
     slug = chunks |> Enum.at(0) |> Enum.join("/")
     op = get_op(chunks)
-    if op_params = get_op_params(op, chunks)
-    && repo = RepositoryManager.get_repository_by_owner_and_slug(params["owner"], slug)
-    && repo.public_access || Repository.member?(repo, current_user) do
+    op_params = get_op_params(op, chunks)
+    repo = RepositoryManager.get_repository_by_owner_and_slug(params["owner"], slug)
+    if op_params && repo && repo.public_access || Repository.member?(repo, current_user) do
       org = repo.organisation
       user = repo.user
       git = setup_git(repo, conn, op, op_params)