mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-01-30 14:30:08 +08:00
fix my laziness
remove exception handling from filter supports check
This commit is contained in:
parent
df509f1b19
commit
c606afc144
@ -2,6 +2,7 @@ package io.papermc.hangar.controller.extras.pagination.filters.log;
|
||||
|
||||
import io.papermc.hangar.controller.extras.pagination.Filter;
|
||||
import io.papermc.hangar.controller.extras.pagination.filters.log.LogPageFilter.LogPageFilterInstance;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.jdbi.v3.core.statement.SqlStatement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -24,8 +25,7 @@ public class LogPageFilter implements Filter<LogPageFilterInstance> {
|
||||
|
||||
@Override
|
||||
public boolean supports(NativeWebRequest webRequest) {
|
||||
Long.parseLong(webRequest.getParameter(getSingleQueryParam()));
|
||||
return true;
|
||||
return Filter.super.supports(webRequest) && NumberUtils.isDigits(webRequest.getParameter(getSingleQueryParam()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@ -55,13 +55,10 @@ public class RequestPaginationResolver implements HandlerMethodArgumentResolver
|
||||
if (applicableFilters != null) {
|
||||
for (Class<? extends Filter<? extends FilterInstance>> filter : applicableFilters) {
|
||||
Filter<? extends FilterInstance> f = filterRegistry.get(filter);
|
||||
try {
|
||||
if (f.supports(webRequest)) {
|
||||
pagination.getFilters().add(f.create(webRequest));
|
||||
paramNames.removeAll(f.getQueryParamNames());
|
||||
}
|
||||
} catch (Exception ignored) { }
|
||||
|
||||
if (f.supports(webRequest)) {
|
||||
pagination.getFilters().add(f.create(webRequest));
|
||||
paramNames.removeAll(f.getQueryParamNames());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user