diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-19 01:57:54 -0400 |
---|---|---|
committer | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-19 01:57:54 -0400 |
commit | f3317eec17b78421d4bcfbaf2efc6216931a3643 (patch) | |
tree | 3b90f68d9c884d35a1b58f4b02ee8d10ce5f3842 /pkg | |
parent | 8805e96a6285a70d512b840ae45d046a1d0e8b26 (diff) | |
download | Atlas-f3317eec17b78421d4bcfbaf2efc6216931a3643.tar.gz Atlas-f3317eec17b78421d4bcfbaf2efc6216931a3643.zip |
pkg/api/api0: Treat /accounts/get_username unknown account the same as an unknown username
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/api0/accounts.go | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/pkg/api/api0/accounts.go b/pkg/api/api0/accounts.go index e4bc085..5167978 100644 --- a/pkg/api/api0/accounts.go +++ b/pkg/api/api0/accounts.go @@ -248,19 +248,14 @@ func (h *Handler) handleAccountsGetUsername(w http.ResponseWriter, r *http.Reque }) return } - if acct == nil { - respJSON(w, r, http.StatusNotFound, map[string]any{ - "success": false, - "uid": strconv.FormatUint(uid, 10), - "matches": []string{}, - "error": ErrorCode_PLAYER_NOT_FOUND.MessageObj(), - }) - return - } + var username string + if acct != nil { + username = acct.Username + } respJSON(w, r, http.StatusOK, map[string]any{ "success": true, "uid": strconv.FormatUint(uid, 10), - "matches": []string{acct.Username}, // yes, this may be an empty string if we don't know what it is + "matches": []string{username}, // yes, this may be an empty string if we don't know what it is }) } |