mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Prevent reduce calls
This commit is contained in:
@@ -97,10 +97,10 @@ export class RedirectingHttpHandler extends HttpHandler {
|
||||
|
||||
// Build redirect URL from regexp result
|
||||
const { match, redirectPattern } = result;
|
||||
const redirect = match.reduce(
|
||||
(prev, param, index): string => prev.replace(`$${index}`, param),
|
||||
redirectPattern,
|
||||
);
|
||||
let redirect = redirectPattern;
|
||||
for (const [ i, element ] of match.entries()) {
|
||||
redirect = redirect.replace(`$${i}`, element);
|
||||
}
|
||||
|
||||
// Don't redirect if target is already correct
|
||||
if (redirect === target) {
|
||||
|
||||
Reference in New Issue
Block a user