Skip to content

Commit

Permalink
small patch to the desktop minimum application version filter
Browse files Browse the repository at this point in the history
  • Loading branch information
andponlin committed Mar 31, 2024
1 parent ac1c7b3 commit 41a466b
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 41a466b

Please sign in to comment.