Commit 11c705127589e809a2dba5eac84b0de099773883

Thomas de Grivel 2022-04-24T17:26:25

fix 404 in tag

diff --git a/lib/kmxgit_web/controllers/repository_controller.ex b/lib/kmxgit_web/controllers/repository_controller.ex
index cbfcd09..2e6471f 100644
--- a/lib/kmxgit_web/controllers/repository_controller.ex
+++ b/lib/kmxgit_web/controllers/repository_controller.ex
@@ -427,13 +427,17 @@ defmodule KmxgitWeb.RepositoryController do
     git = git
     |> git_put_tags(repo, conn, op, nil)
     tag = Enum.find(git.tags, fn tag -> tag.tag == tree end)
-    conn
-    |> assign_current_organisation(org)
-    |> assign(:current_repository, repo)
-    |> assign(:path, nil)
-    |> assign(:repo, repo)
-    |> assign(:tag, tag)
-    |> render("tag.html")
+    if tag do
+      conn
+      |> assign_current_organisation(org)
+      |> assign(:current_repository, repo)
+      |> assign(:path, nil)
+      |> assign(:repo, repo)
+      |> assign(:tag, tag)
+      |> render("tag.html")
+    else
+      not_found(conn)
+    end
   end
   defp show_op(conn, :tree = op, %{tree: tree, git: git, org: org, path: path, repo: repo, user: user}) do
     git = git