diff --git a/src/main/kotlin/dev/usbharu/hideout/routing/UserRouting.kt b/src/main/kotlin/dev/usbharu/hideout/routing/UserRouting.kt index d39c3c7f..af03a5fa 100644 --- a/src/main/kotlin/dev/usbharu/hideout/routing/UserRouting.kt +++ b/src/main/kotlin/dev/usbharu/hideout/routing/UserRouting.kt @@ -67,7 +67,7 @@ fun Application.user(userService: UserService, activityPubUserService: ActivityP } } get("/{name}/icon.png"){ - call.respondBytes(Application::class.java.classLoader.getResourceAsStream("/icon.png").readAllBytes(),ContentType.Image.PNG) + call.respondBytes(javaClass.classLoader.getResourceAsStream("icon.png").readAllBytes(),ContentType.Image.PNG) } } diff --git a/src/test/kotlin/dev/usbharu/hideout/routing/UserRoutingKtTest.kt b/src/test/kotlin/dev/usbharu/hideout/routing/UserRoutingKtTest.kt new file mode 100644 index 00000000..6027b7e2 --- /dev/null +++ b/src/test/kotlin/dev/usbharu/hideout/routing/UserRoutingKtTest.kt @@ -0,0 +1,12 @@ +package dev.usbharu.hideout.routing + +import org.junit.jupiter.api.Test + +class UserRoutingKtTest { + @Test + fun userIconTest() { + println(String.Companion::class.java.classLoader) + println(String::class.java.classLoader) + println(String.javaClass.classLoader.getResourceAsStream("icon.png")?.readAllBytes()) + } +}