fix: webfingerのif式を修正

This commit is contained in:
usbharu 2023-03-24 17:37:44 +09:00
parent a442f5ae33
commit 9821846c42
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
1 changed files with 4 additions and 4 deletions

View File

@ -49,15 +49,15 @@ fun Application.wellKnown(userService: UserService) {
val uri = call.request.queryParameters["resource"] ?: return@get call.respondText("resource was not found",
status = HttpStatusCode.BadRequest
)
if (uri.decodeURLPart().startsWith("acct:")) {
val decodeURLPart = uri.decodeURLPart()
if (!decodeURLPart.startsWith("acct:")) {
return@get call.respondText("$uri was not found.",status =HttpStatusCode.BadRequest)
}
val accountName = uri.substringBeforeLast("@")
val accountName = uri.substringBeforeLast("@").substringAfter("@")
val userEntity = userService.findByName(accountName)
return@get call.respond(WebFingerResource(
subject = userEntity.name,
subject = decodeURLPart,
listOf(
WebFingerResource.Link(
rel ="self",