go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.98k stars 5.48k forks source link

[bug] Nil exeption for libravatar #15421

Closed 6543 closed 3 years ago

6543 commented 3 years ago
2021/04/12 07:21:37 ...uters/routes/base.go:153:1() [E] PANIC: runtime error: invalid memory address or nil pointer dereference
        /usr/lib/go/src/runtime/panic.go:212 (0x43eafa)   
                panicmem: panic(memoryError)                                                                                           
        /usr/lib/go/src/runtime/signal_unix.go:734 (0x458852)
                sigpanic: panicmem()                                                                                                   
        /home/buildozer/aports/community/gitea/src/src/code.gitea.io/gitea/vendor/strk.kbt.io/projects/go/libravatar/libravatar.go:175 (0x9a57da)
        /home/buildozer/aports/community/gitea/src/src/code.gitea.io/gitea/vendor/strk.kbt.io/projects/go/libravatar/libravatar.go:151 (0x9a51dc)
        /home/buildozer/aports/community/gitea/src/src/code.gitea.io/gitea/vendor/strk.kbt.io/projects/go/libravatar/libravatar.go:269 (0x9a636d)
        /home/buildozer/aports/community/gitea/src/src/code.gitea.io/gitea/models/avatar.go:70 (0x12a806a)                                                                                                                                                                     
        /home/buildozer/aports/community/gitea/src/src/code.gitea.io/gitea/routers/user/avatar.go:73 (0x1e22313)                                                                                                                                                               
        /home/buildozer/aports/community/gitea/src/src/code.gitea.io/gitea/modules/web/route.go:53 (0x1de6c8b)                                                                                                                                                                 
        /usr/lib/go/src/net/http/server.go:2069 (0x7c1f03)
                HandlerFunc.ServeHTTP: f(w, r)
        /home/buildozer/aports/community/gitea/src/src/code.gitea.io/gitea/vendor/github.com/go-chi/chi/mux.go:436 (0x19a01ca)
        /usr/lib/go/src/net/http/server.go:2069 (0x7c1f03)
                HandlerFunc.ServeHTTP: f(w, r)
        /home/buildozer/aports/community/gitea/src/src/code.gitea.io/gitea/modules/web/route.go:92 (0x1de71f6)
        /usr/lib/go/src/net/http/server.go:2069 (0x7c1f03)
                HandlerFunc.ServeHTTP: f(w, r)
        /home/buildozer/aports/community/gitea/src/src/code.gitea.io/gitea/modules/web/route.go:92 (0x1de71f6)
        /usr/lib/go/src/net/http/server.go:2069 (0x7c1f03)
                HandlerFunc.ServeHTTP: f(w, r)
        /home/buildozer/aports/community/gitea/src/src/code.gitea.io/gitea/modules/web/route.go:92 (0x1de71f6)
        /usr/lib/go/src/net/http/server.go:2069 (0x7c1f03)
                HandlerFunc.ServeHTTP: f(w, r)
        /home/buildozer/aports/community/gitea/src/src/code.gitea.io/gitea/vendor/github.com/go-chi/chi/middleware/get_head.go:37 (0x2016681)
6543 commented 3 years ago

upstream repo https://gitlab.com/strk/go-libravatar?

6543 commented 3 years ago

we can fix the nil issue upstream, but gitea managed to not initialize settings.LibravatarService in the first place ...

zeripath commented 3 years ago

So the issue is that #13649 should have used the similar logic to SizedAvatarLink()