Encode usernames in API requests and navigation links to handle special characters.

This commit is contained in:
2025-06-23 21:33:55 +08:00
parent be067cc21a
commit 8136e32d55
4 changed files with 25 additions and 15 deletions

View File

@@ -581,7 +581,7 @@ class Network {
): Promise<PageResponse<Resource>> {
try {
const response = await axios.get(
`${this.apiBaseUrl}/resource/user/${username}`,
`${this.apiBaseUrl}/resource/user/${encodeURIComponent(username)}`,
{
params: {
page,
@@ -978,7 +978,7 @@ class Network {
): Promise<PageResponse<CommentWithResource>> {
try {
const response = await axios.get(
`${this.apiBaseUrl}/comments/user/${username}`,
`${this.apiBaseUrl}/comments/user/${encodeURIComponent(username)}`,
{
params: { page },
},