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.
gitea/routers/web
Giteabot 4ffa683820
Fix panic in storageHandler (#27446) (#27478)
Backport #27446 by @sryze

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 (?)

Co-authored-by: Sergey Zolotarev <sryze@outlook.com>
1 year ago
..
admin Fix admin queue page title and fix CI failures (#26409) (#26421) 2 years ago
auth Replace `interface{}` with `any` (#25686) (#25687) 2 years ago
devtest Make "cancel" buttons have proper type in modal forms (#25618) (#25641) 2 years ago
events Implement FSFE REUSE for golang files (#21840) 2 years ago
explore Replace `interface{}` with `any` (#25686) (#25687) 2 years ago
feed Pass 'not' to commit count (#24473) 2 years ago
healthcheck Refactor `setting.Database.UseXXX` to methods (#23354) 2 years ago
misc Decouple the different contexts from each other (#24786) 2 years ago
org fix incorrect repo url when changed the case of ownername (#25733) (#25881) 2 years ago
repo When comparing with an non-exist repository, return 404 but 500 (#27437) (#27441) 1 year ago
shared Fix typo of RunerOwnerID (#26508) (#26528) 2 years ago
user fix pagination for followers and following (#27127) (#27138) 1 year ago
auth.go Implement FSFE REUSE for golang files (#21840) 2 years ago
auth_windows.go Implement FSFE REUSE for golang files (#21840) 2 years ago
base.go Fix panic in storageHandler (#27446) (#27478) 1 year ago
goget.go Support SSH for go get (#24664) 2 years ago
home.go Refactor cookie (#24107) 2 years 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 Group template helper functions, remove `Printf`, improve template error messages (#23982) 2 years ago
web.go Allow get release download files and lfs files with oauth2 token format (#26430) (#27378) 1 year ago
webfinger.go Replace `interface{}` with `any` (#25686) (#25687) 2 years ago