From 41a466b7913f2911cd80d9bccc404d2c0aa1c45b Mon Sep 17 00:00:00 2001 From: Andrew Lindesay Date: Sun, 31 Mar 2024 22:04:06 +1300 Subject: [PATCH] small patch to the desktop minimum application version filter --- .../DesktopApplicationMinimumVersionFilter.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/haikudepotserver-webapp/src/main/java/org/haiku/haikudepotserver/support/desktopapplication/DesktopApplicationMinimumVersionFilter.java b/haikudepotserver-webapp/src/main/java/org/haiku/haikudepotserver/support/desktopapplication/DesktopApplicationMinimumVersionFilter.java index 4bc81ff9..a60b5290 100644 --- a/haikudepotserver-webapp/src/main/java/org/haiku/haikudepotserver/support/desktopapplication/DesktopApplicationMinimumVersionFilter.java +++ b/haikudepotserver-webapp/src/main/java/org/haiku/haikudepotserver/support/desktopapplication/DesktopApplicationMinimumVersionFilter.java @@ -10,6 +10,7 @@ import jakarta.servlet.*; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import org.apache.commons.lang3.StringUtils; import org.haiku.haikudepotserver.support.IntArrayVersionComparator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,8 +38,9 @@ public class DesktopApplicationMinimumVersionFilter implements Filter { public DesktopApplicationMinimumVersionFilter(String minimumVersionString) { this.minimumVersion = Optional.ofNullable(minimumVersionString) - .map(DesktopApplicationHelper::deriveVersion) - .orElse(null); + .filter(StringUtils::isNotBlank) + .map(DesktopApplicationHelper::deriveVersion) + .orElse(null); } /** @@ -75,8 +77,7 @@ public void doFilter( if (checkVersion(userAgentString)) { chain.doFilter(request, response); - } - else { + } else { String minimumVersionString = DesktopApplicationHelper.versionToString(minimumVersion); HttpServletResponse httpServletResponse = (HttpServletResponse) response;