fix: resolve with non-lowercased acct is broken (#15813)

* fix: resolve with non-lowercased acct is broken

* docs(changelog): Fix: 大文字を含むユーザの URL で紹介された場合に 404 エラーを返す問題
This commit is contained in:
anatawa12 2025-04-13 18:34:33 +09:00 committed by GitHub
parent f7195d54d0
commit 4c473eb76d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 8 additions and 8 deletions

View file

@ -9,7 +9,7 @@
### Server ### Server
- Fix: システムアカウントの名前がサーバー名と同期されない問題を修正 - Fix: システムアカウントの名前がサーバー名と同期されない問題を修正
- Fix: 大文字を含むユーザの URL で紹介された場合に 404 エラーを返す問題 #15813
## 2025.4.0 ## 2025.4.0

View file

@ -735,7 +735,7 @@ export class ActivityPubServerService {
const acct = Acct.parse(request.params.acct); const acct = Acct.parse(request.params.acct);
const user = await this.usersRepository.findOneBy({ const user = await this.usersRepository.findOneBy({
usernameLower: acct.username, usernameLower: acct.username.toLowerCase(),
host: acct.host ?? IsNull(), host: acct.host ?? IsNull(),
isSuspended: false, isSuspended: false,
}); });

View file

@ -138,7 +138,7 @@ fastify.get('/.well-known/change-password', async (request, reply) => {
const fromAcct = (acct: Acct.Acct): FindOptionsWhere<MiUser> | number => const fromAcct = (acct: Acct.Acct): FindOptionsWhere<MiUser> | number =>
!acct.host || acct.host === this.config.host.toLowerCase() ? { !acct.host || acct.host === this.config.host.toLowerCase() ? {
usernameLower: acct.username, usernameLower: acct.username.toLowerCase(),
host: IsNull(), host: IsNull(),
isSuspended: false, isSuspended: false,
} : 422; } : 422;

View file

@ -44,7 +44,7 @@ describe('AnnouncementService', () => {
return usersRepository.insert({ return usersRepository.insert({
id: genAidx(Date.now()), id: genAidx(Date.now()),
username: un, username: un,
usernameLower: un, usernameLower: un.toLowerCase(),
...data, ...data,
}) })
.then(x => usersRepository.findOneByOrFail(x.identifiers[0])); .then(x => usersRepository.findOneByOrFail(x.identifiers[0]));

View file

@ -115,7 +115,7 @@ describe('SigninWithPasskeyApiService', () => {
jest.spyOn(webAuthnService, 'verifySignInWithPasskeyAuthentication').mockImplementation(FakeWebauthnVerify); jest.spyOn(webAuthnService, 'verifySignInWithPasskeyAuthentication').mockImplementation(FakeWebauthnVerify);
const dummyUser = { const dummyUser = {
id: uid, username: uid, usernameLower: uid.toLocaleLowerCase(), uri: null, host: null, id: uid, username: uid, usernameLower: uid.toLowerCase(), uri: null, host: null,
}; };
const dummyProfile = { const dummyProfile = {
userId: uid, userId: uid,

View file

@ -74,7 +74,7 @@ describe('UserEntityService', () => {
...userData, ...userData,
id: genAidx(Date.now()), id: genAidx(Date.now()),
username: un, username: un,
usernameLower: un, usernameLower: un.toLowerCase(),
}) })
.then(x => usersRepository.findOneByOrFail(x.identifiers[0])); .then(x => usersRepository.findOneByOrFail(x.identifiers[0]));