返回提交历史
Modified
src/controllers/api/getAccountIdController.ts
+4
-1
XFEstudio/XFESpaceNinjaServer
chore: handle getAccountId with unicode suffix (#3543)
Closes #3539 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3543 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
14c1ff00
代码差异
1 个文件
+4
-1
@@ -3,7 +3,10 @@ import { getJSONfromString } from "../../helpers/stringHelpers.ts";
3
3
import { Account } from "../../models/loginModel.ts";
4
4
5
5
export const getAccountIdController: RequestHandler = async (req, res) => {
6
const { targetName } = getJSONfromString<IGetAccountIdRequest>(String(req.body));
6
let { targetName } = getJSONfromString<IGetAccountIdRequest>(String(req.body));
7
if (targetName.charCodeAt(targetName.length - 1) >= 0xe000) {
8
targetName = targetName.substring(0, targetName.length - 1);
9
}
7
10
const account = await Account.findOne({ DisplayName: targetName }, "_id DisplayName");
8
11
if (account) {
9
12
res.send(`${account._id.toString()},${account.DisplayName}`);