summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorAravinth Manivannan <realaravinth@batsense.net>2024-04-01 21:57:28 +0200
committerEarl Warren <earl-warren@noreply.codeberg.org>2024-04-04 18:52:25 +0200
commitf7ca56557cb8c8d606ed4640ae739f970ebbb609 (patch)
tree4f061444f452ca8ef659e2d80954e43396651069 /routers
parentfeat: improve URI parsing in webfinger endpoint (diff)
downloadforgejo-f7ca56557cb8c8d606ed4640ae739f970ebbb609.tar.xz
forgejo-f7ca56557cb8c8d606ed4640ae739f970ebbb609.zip
feat: parse for all ForgeFed actors
Diffstat (limited to 'routers')
-rw-r--r--routers/web/webfinger.go65
1 files changed, 33 insertions, 32 deletions
diff --git a/routers/web/webfinger.go b/routers/web/webfinger.go
index 2eced4f05f..65963cf379 100644
--- a/routers/web/webfinger.go
+++ b/routers/web/webfinger.go
@@ -82,38 +82,39 @@ func WebfingerQuery(ctx *context.Context) {
switch len(parts) {
case 1: // user
u, err = user_model.GetUserByName(ctx, parts[0])
- // case 2: // repository
- // ctx.Error(http.StatusNotFound)
- // return
- //
- // case 3:
- // switch parts[2] {
- // case "issues":
- // ctx.Error(http.StatusNotFound)
- // return
- //
- // case "pulls":
- // ctx.Error(http.StatusNotFound)
- // return
- //
- // case "projects":
- // ctx.Error(http.StatusNotFound)
- // return
- //
- // default:
- // ctx.Error(http.StatusNotFound)
- // return
- //
- // }
- // case 4:
- // if parts[3] == "teams" {
- // ctx.Error(http.StatusNotFound)
- // return
- //
- // } else {
- // ctx.Error(http.StatusNotFound)
- // return
- // }
+ case 2: // repository
+ ctx.Error(http.StatusNotFound)
+ return
+
+ case 3:
+ switch parts[2] {
+ case "issues":
+ ctx.Error(http.StatusNotFound)
+ return
+
+ case "pulls":
+ ctx.Error(http.StatusNotFound)
+ return
+
+ case "projects":
+ ctx.Error(http.StatusNotFound)
+ return
+
+ default:
+ ctx.Error(http.StatusNotFound)
+ return
+
+ }
+ case 4:
+ //nolint:gocritic
+ if parts[3] == "teams" {
+ ctx.Error(http.StatusNotFound)
+ return
+
+ } else {
+ ctx.Error(http.StatusNotFound)
+ return
+ }
default:
ctx.Error(http.StatusNotFound)