fix: correct user context handling and error responses
- Fix SearchMediaItems to retrieve user object from context instead of string - Remove redundant UUID parsing, use user.ID directly - Add error logging for search failures with query details - Fix JWT middleware to use echo.NewHTTPError for consistent error format - Improves debugging and error response consistency across API
This commit is contained in:
@@ -83,7 +83,7 @@ func createJWTMiddleware(cfg *Config) echo.MiddlewareFunc {
|
||||
userIDStr, _ := claims["user_id"].(string)
|
||||
userUUID, err := uuid.Parse(userIDStr)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid user ID in token"})
|
||||
c.Error(echo.NewHTTPError(http.StatusBadRequest, "invalid user ID in token"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user