From 253a71718c0d6214ef5e8cd658380bb8382fad7c Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 15 Apr 2024 10:26:58 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B2=98=EC=9D=8C=EA=B3=BC=20=EB=81=9D?= =?UTF-8?q?=EC=9D=98=20=EB=8C=80=EA=B4=84=ED=98=B8=EB=A5=BC=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=EC=9C=BC=EB=A1=9C=20=EC=97=86=EC=95=A4=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../render/controller/AnimationController.kt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt index dda6b81..0fd4e2d 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/AnimationController.kt @@ -19,7 +19,7 @@ class AnimationController( response: HttpServletResponse ): String { response.cacheControl(3600) - return animationFacade.getFarmAnimation(username) + return animationFacade.getFarmAnimation(deleteBrackets(username)) } @GetMapping(value = ["/lines/{username}"], produces = ["image/svg+xml"]) @@ -29,7 +29,21 @@ class AnimationController( response: HttpServletResponse, ): String { response.cacheControl(3600) - return animationFacade.getLineAnimation(username, personaId) + return animationFacade.getLineAnimation(deleteBrackets(username), personaId) + } + + private fun deleteBrackets(username: String): String { + val start = when (username[0]) { + '{' -> 1 + else -> 0 + } + + val end = when (username.last()) { + '}' -> username.length - 1 + else -> username.length + } + + return username.substring(start, end) } fun HttpServletResponse.cacheControl(maxAgeSeconds: Int): HttpServletResponse {