Commit 7bf018430d48a738575a59d7a78dd4f0110b4a7e

Thomas de Grivel 2022-05-02T18:40:31

check git dir

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/lib/kmxgit/git_manager.ex b/lib/kmxgit/git_manager.ex
index 6d1f4d6..fbeeb6b 100644
--- a/lib/kmxgit/git_manager.ex
+++ b/lib/kmxgit/git_manager.ex
@@ -3,6 +3,7 @@ defmodule Kmxgit.GitManager do
   @git_root "priv/git"
 
   def git_dir(repo) do
+    if String.match?(repo, ~r/(^|\/)\.\.($|\/)/), do: raise "invalid git dir"
     "#{@git_root}/#{repo}.git"
   end