Commit 3d6cd693fbb2031b0c1bc64bb5fe8145fa74b235

Thomas de Grivel 2022-01-29T13:19:19

fix repository show git content

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/kmxgit_web/controllers/repository_controller.ex b/lib/kmxgit_web/controllers/repository_controller.ex
index 04ac84a..72c2b9a 100644
--- a/lib/kmxgit_web/controllers/repository_controller.ex
+++ b/lib/kmxgit_web/controllers/repository_controller.ex
@@ -251,7 +251,7 @@ defmodule KmxgitWeb.RepositoryController do
                         end
           content_html = Pygmentize.html(content, filename(name))
           line_numbers = line_numbers(content)
-          markdown_html = if String.match?(ext, ~r/md/i) do
+          markdown_html = if ext && String.match?(ext, ~r/md/i) do
             Earmark.as_html!(content)
           end
           IO.inspect(path: path, name: name, type: type)