From 0be3bb4b84e55dff9db350dda3a22e10a07b366e Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Tue, 29 Oct 2019 18:28:34 +0800 Subject: [PATCH] bug fix: prevent circular loop in the error resolver, which would complain in logs --- .../komga/infrastructure/web/SPAErrorViewResolver.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/SPAErrorViewResolver.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/SPAErrorViewResolver.kt index da51833d0..742af7f38 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/SPAErrorViewResolver.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/SPAErrorViewResolver.kt @@ -9,10 +9,10 @@ import javax.servlet.http.HttpServletRequest @Component class SPAErrorViewResolver : ErrorViewResolver { - override fun resolveErrorView(request: HttpServletRequest, status: HttpStatus, model: MutableMap): ModelAndView = - if (status == HttpStatus.NOT_FOUND) { - ModelAndView("/", HttpStatus.TEMPORARY_REDIRECT) - } else { - ModelAndView("/error", status) + override fun resolveErrorView(request: HttpServletRequest, status: HttpStatus, model: MutableMap): ModelAndView? = + when { + request.requestURL.toString() == "/error" -> null + status == HttpStatus.NOT_FOUND -> ModelAndView("/", HttpStatus.TEMPORARY_REDIRECT) + else -> ModelAndView("/error", status) } }