Commit 118d9dab020560ad237f6d78b17b434fff205bb9

Thomas de Grivel 2022-03-05T15:37:00

fix 500 in repository show, op_params parser

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 bb91838..f730459 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)
-    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
+    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
       org = repo.organisation
       user = repo.user
       git = setup_git(repo, conn, op, op_params)