Skip to content

Commit

Permalink
AB#46862: Refactor route filtering logic (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-halinen authored Nov 18, 2024
1 parent 83f0e6b commit 07d2fa5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/util/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,19 @@ function routeGeneralizer(routes) {
function filterRoute(props) {
const { filter } = props;
const { routeId } = props;
const routeIdParsed = trimRouteId(routeId);
if (!filter) {
return true;
}
for (let i = 0; i < filter.length; i++) {
const char = filter[i];
if (char !== '*' && char === routeId[i]) {
return false;

const filteredRoutes = filter.split(',').map(routeIdToFilter => routeIdToFilter.trim());
let routeMatchesFilter = false;
filteredRoutes.forEach(filterRouteId => {
if (routeId.includes(filterRouteId) && filterRouteId === routeIdParsed) {
routeMatchesFilter = true;
}
}
return true;
});
return !routeMatchesFilter;
}

export {
Expand Down

0 comments on commit 07d2fa5

Please sign in to comment.