Update portal.go
This commit is contained in:
+9
-2
@@ -19,8 +19,15 @@ func PortalUser(c *fiber.Ctx) (*models.PortalUser, error) {
|
||||
if raw == nil {
|
||||
return nil, errors.New("no portal session")
|
||||
}
|
||||
id, ok := raw.(uint)
|
||||
if !ok {
|
||||
var id uint
|
||||
switch v := raw.(type) {
|
||||
case uint:
|
||||
id = v
|
||||
case int64:
|
||||
id = uint(v)
|
||||
case float64:
|
||||
id = uint(v)
|
||||
default:
|
||||
log.Printf("[PORTAL SESSION] type assertion failed: %T", raw)
|
||||
return nil, errors.New("invalid portal session")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user