You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sergey Zolotarev 7b79be24ca
Fix panic in storageHandler (#27446)
storageHandler() is written as a middleware but is used as an endpoint
handler, and thus `next` is actually `nil`, which causes a null pointer
dereference when a request URL does not match the pattern (where it
calls `next.ServerHTTP()`).

Example CURL command to trigger the panic:

```
curl -I "http://yourhost/gitea//avatars/a"
```

Fixes #27409

---

Note: the diff looks big but it's actually a small change - all I did
was to remove the outer closure (and one level of indentation) ~and
removed the HTTP method and pattern checks as they seem redundant
because go-chi already does those checks~. You might want to check "Hide
whitespace" when reviewing it.

Alternative solution (a bit simpler): append `, misc.DummyOK` to the
route declarations that utilize `storageHandler()` - this makes it
return an empty response when the URL is invalid. I've tested this one
and it works too. Or maybe it would be better to return a 400 error in
that case (?)
9 months ago
..
admin Refactor system setting (#27000) 9 months ago
auth Even more `db.DefaultContext` refactor (#27352) 9 months ago
devtest Make "cancel" buttons have proper type in modal forms (#25618) 1 year ago
events Implement FSFE REUSE for golang files (#21840) 2 years ago
explore Next round of `db.DefaultContext` refactor (#27089) 10 months ago
feed More `db.DefaultContext` refactor (#27265) 9 months ago
healthcheck Remove `db.DefaultContext` in `routers/` and `cmd/` (#26076) 11 months ago
misc Serve pre-defined files in "public", add "security.txt", add CORS header for ".well-known" (#25974) 12 months ago
org Even more `db.DefaultContext` refactor (#27352) 9 months ago
repo Remove redundant `len` check around loop (#27464) 9 months ago
shared Even more `db.DefaultContext` refactor (#27352) 9 months ago
user Refactor system setting (#27000) 9 months ago
base.go Fix panic in storageHandler (#27446) 9 months ago
goget.go Support SSH for go get (#24664) 1 year ago
home.go Reduce usage of `db.DefaultContext` (#27073) 10 months ago
metrics.go Implement FSFE REUSE for golang files (#21840) 2 years ago
nodeinfo.go Implement FSFE REUSE for golang files (#21840) 2 years ago
swagger_json.go Start using template context function (#26254) 11 months ago
web.go Allow get release download files and lfs files with oauth2 token format (#26430) 9 months ago
webfinger.go Add a link to OpenID Issuer URL in WebFinger response (#26000) 12 months ago