Skip to content

Commit

Permalink
Merge pull request from GHSA-r7h4-76f7-6264
Browse files Browse the repository at this point in the history
* Actually use maxUsername config value.

* Change maxUsername default to discord.com default
  • Loading branch information
MaddyUnderStars authored Feb 2, 2023
1 parent d8f32cb commit a03f7c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/api/routes/users/@me/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ router.patch(
},
});
}

const { maxUsername } = Config.get().limits.user;
if (check_username.length > maxUsername) {
throw FieldErrors({
username: {
code: "USERNAME_INVALID",
message: `Username must be less than ${maxUsername} in length`,
},
});
}
}

if (body.discriminator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@

export class UserLimits {
maxGuilds: number = 1048576;
maxUsername: number = 127;
maxUsername: number = 32;
maxFriends: number = 5000;
}

0 comments on commit a03f7c8

Please sign in to comment.