Skip to content

Commit

Permalink
fix(@angular/build): prevent redirection loop
Browse files Browse the repository at this point in the history
Added handling to ensure trailing slashes on static files do not disregard query strings.

Closes #28071

(cherry picked from commit 6d69375)
  • Loading branch information
alan-agius4 committed Jul 18, 2024
1 parent 2601941 commit d868270
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export function createAngularAssetsMiddleware(
if (!pathnameHasTrailingSlash) {
for (const assetPath of assets.keys()) {
if (pathname === assetPath.substring(0, assetPath.lastIndexOf('/'))) {
const location = req.url + '/';
const { pathname, search, hash } = new URL(req.url, 'http://localhost');
const location = [pathname, '/', search, hash].join('');

res.statusCode = 301;
res.setHeader('Content-Type', 'text/html');
Expand Down

0 comments on commit d868270

Please sign in to comment.