Skip to content

Commit 5383f74

Browse files
committed
logic update
1 parent 9ef84c7 commit 5383f74

File tree

2 files changed

+20
-199
lines changed

2 files changed

+20
-199
lines changed

deno.lock

Lines changed: 15 additions & 193 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/fresh/src/middlewares/ip_filter.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,13 @@ export function ipFilter<State>(
126126
return onBlock({ addr, type }, ctx);
127127
}
128128

129-
if (matchSubnets(addr, rules.allowList || [])) {
129+
if (
130+
(rules.allowList || []).length === 0 ||
131+
matchSubnets(addr, rules.allowList || [])
132+
) {
130133
return ctx.next();
131134
}
132135

133-
if ((rules.allowList || []).length === 0) {
134-
return ctx.next();
135-
} else {
136-
return onBlock({ addr, type }, ctx);
137-
}
136+
return onBlock({ addr, type }, ctx);
138137
};
139138
}

0 commit comments

Comments
 (0)