Skip to content

Commit 4c9f6ac

Browse files
committed
More safety, incase theres a regex mistake
1 parent 1edb201 commit 4c9f6ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/angular/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export const handle = async (req: Request, res: Response) => {
1515
const locale = req.query.locale || "";
1616
if (typeof locale !== "string") return res.sendStatus(404);
1717
if (!LOCALE_FORMATS.some(it => locale.match(it))) return res.sendStatus(404);
18-
const serveFrom = `./dist/hosting/browser/${locale}`;
19-
const normalizedPath = normalize(join(serveFrom, src));
18+
const serveFrom = "./dist/hosting/browser";
19+
const normalizedPath = normalize(join(serveFrom, locale, src));
2020
if (relative(serveFrom, normalizedPath).startsWith("..")) return res.sendStatus(404);
2121
const { default: sharp} = await import("sharp");
2222
const width = typeof req.query.width === "string" ? parseInt(req.query.width) : undefined;

0 commit comments

Comments
 (0)