[PATCH links] Fixing edge case tracebacks.
Export this patch
---
helpers.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/helpers.go b/helpers.go
index e086eb2..3a860bc 100644
--- a/helpers.go
+++ b/helpers.go
@@ -1172,7 +1172,7 @@ func NewRateLimiterConfig(conf *config.Config) (middleware.RateLimiterConfig, er
}
if gctx, ok := c.(*server.Context); ok {
- if gctx.User.IsAuthenticated() && gctx.User.IsSuperUser() {
+ if gctx.User != nil && gctx.User.IsAuthenticated() && gctx.User.IsSuperUser() {
return true
}
}
@@ -1187,7 +1187,7 @@ func NewRateLimiterConfig(conf *config.Config) (middleware.RateLimiterConfig, er
)
rlConfig.IdentifierExtractor = func(c echo.Context) (string, error) {
if gctx, ok := c.(*server.Context); ok {
- if gctx.User.IsAuthenticated() {
+ if gctx.User != nil && gctx.User.IsAuthenticated() {
return fmt.Sprintf("user:%d", gctx.User.GetID()), nil
}
}
--
2.49.1
Applied.
To git@git.code.netlandish.com:~netlandish/links
5f89d68..271d9a6 master -> master