From 8f230b98249f9f628c1d63dec87fdd450ad3eab6 Mon Sep 17 00:00:00 2001 From: crystal <71373843+CrystalCommunication@users.noreply.github.com> Date: Thu, 5 Jan 2023 23:46:39 -0700 Subject: [PATCH 1/2] make /{username}.png redirect to user/org avatar --- routers/web/web.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/web.go b/routers/web/web.go index 31b3eb9baadac..76e67d27f0d88 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -634,7 +634,7 @@ func RegisterRoutes(m *web.Route) { http.ServeFile(ctx.Resp, ctx.Req, path.Join(setting.StaticRootPath, "public/img/favicon.png")) }) m.Group("/{username}", func() { - m.Get(".png", func(ctx *context.Context) { ctx.Error(http.StatusNotFound) }) + m.Get(".png", func(ctx *context.Context) { user.AvatarByUserName(ctx) }) m.Get(".keys", user.ShowSSHKeys) m.Get(".gpg", user.ShowGPGKeys) m.Get(".rss", feedEnabled, feed.ShowUserFeedRSS) From 926a32350b80ffcdcd1e13faa18b081854fd46ee Mon Sep 17 00:00:00 2001 From: crystal <71373843+CrystalCommunication@users.noreply.github.com> Date: Fri, 6 Jan 2023 02:21:13 -0700 Subject: [PATCH 2/2] that was really hacky, this is better --- routers/web/web.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/web.go b/routers/web/web.go index 76e67d27f0d88..997185974c201 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -634,7 +634,7 @@ func RegisterRoutes(m *web.Route) { http.ServeFile(ctx.Resp, ctx.Req, path.Join(setting.StaticRootPath, "public/img/favicon.png")) }) m.Group("/{username}", func() { - m.Get(".png", func(ctx *context.Context) { user.AvatarByUserName(ctx) }) + m.Get(".png", user.AvatarByUserName) m.Get(".keys", user.ShowSSHKeys) m.Get(".gpg", user.ShowGPGKeys) m.Get(".rss", feedEnabled, feed.ShowUserFeedRSS)