mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 04:17:23 +00:00
Add URL decoding for username in user retrieval
This commit is contained in:
@@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"nysoure/server/model"
|
||||
"nysoure/server/service"
|
||||
"strconv"
|
||||
@@ -267,6 +268,10 @@ func handleGetUserInfo(c fiber.Ctx) error {
|
||||
if username == "" {
|
||||
return model.NewRequestError("Username is required")
|
||||
}
|
||||
username, err := url.QueryUnescape(username)
|
||||
if err != nil {
|
||||
return model.NewRequestError("Invalid username")
|
||||
}
|
||||
user, err := service.GetUserByUsername(username)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user