1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
diff --git a/internal/handler/404.go b/internal/handler/404.go
index c564165b5a41e43c746559913ddc5b53b93d8de2..b24c736277d80ba58c984803b4225abbcbcaae70 100644
--- a/internal/handler/404.go
+++ b/internal/handler/404.go
@@ -15,6 +15,8 @@ switch {
case errors.Is(err, ErrNotFound):
status = fasthttp.StatusNotFound
log.Warn(err.Error(), "path", ctx.Path())
+ case errors.Is(err, ErrNotImplemented):
+ status = fasthttp.StatusNotImplemented
default:
log.Error("internal server error", "error", err.Error())
}
@@ -23,4 +25,7 @@
_, _ = fmt.Fprintf(ctx, "error: %v", err)
}
-var ErrNotFound = errors.New("page not found")
+var (
+ ErrNotFound = errors.New("page not found")
+ ErrNotImplemented = errors.New("not yet implemented")
+)
diff --git a/internal/handler/repo.go b/internal/handler/repo.go
index 882cf3ddc1faae267ffdd98d142bc2ddcc35e2fb..32d9e39a463e6ba0d188490e48792128f96ab7b0 100644
--- a/internal/handler/repo.go
+++ b/internal/handler/repo.go
@@ -11,9 +11,9 @@ )
func (h *Handler) repoHandler(ctx *fasthttp.RequestCtx, repo *types.Repo) {
log := conman.GetLogger(ctx)
- log.Debug("handling repository request", "repo", repo.Name)
operation := strings.TrimPrefix(string(ctx.Path()), repo.Path)
operation = strings.SplitN(strings.TrimPrefix(operation, "/"), "/", 2)[0]
+ log.Debug("handling repository request", "repo", repo.Name, "operation", operation)
switch operation {
case "":
templates.Overview(repo)(ctx)
@@ -23,6 +23,10 @@ case "tag":
tagHandler(repo)(ctx)
case "commit":
commitHandler(repo)(ctx)
+ case "ref":
+ errorHandler(ctx, ErrNotImplemented)
+ case "tree":
+ errorHandler(ctx, ErrNotImplemented)
default:
errorHandler(ctx, ErrNotFound)
}
diff --git a/internal/handler/wrap-repo.go b/internal/handler/wrap-repo.go
deleted file mode 100644
index abeebd162ee44d9c076ced7c51310c2501f7b7af..0000000000000000000000000000000000000000
--- a/internal/handler/wrap-repo.go
+++ /dev/null
@@ -1 +0,0 @@
-package handler
|