]> git.ardis.lu - git.ardis.lu/commitdiff
Make regex more explicit
authorArdis Lu <ardisglu@gmail.com>
Tue, 28 Jul 2026 06:05:22 +0000 (23:05 -0700)
committerArdis Lu <ardisglu@gmail.com>
Tue, 28 Jul 2026 06:05:22 +0000 (23:05 -0700)
Discarding the other capture groups makes the intent clearer.

etc/caddy/Caddyfile

index cb4fc0649c6e9c6f9f97fe5ff0a1fb2662b46109..d98566f75b186702abd30faa805468627a6ee76e 100644 (file)
@@ -19,8 +19,8 @@ git.ardis.lu {
   }
 
   # For /[name] and /[name].git WITHOUT additional paths, redirect to /?p=[name] for human-friendly browsing
-  @git_bare path_regexp ^(\/)([A-Za-z0-9_.-]+?)(\.git)?$
-  redir @git_bare /?p={re.2}
+  @git_bare path_regexp ^\/([A-Za-z0-9_.-]+?)(?:\.git)?$
+  redir @git_bare /?p={re.1}
 
   # For /[name].git WITH additional paths, serve git-http-backend to support git operations
   # {method}, {path}, {query} are magic Caddy variables which correspond to the URL
This page took 0.039778 seconds and 4 git commands to generate.