Skip to content

Commit 8fd7409

Browse files
authored
fix(react-email): Static files regression (#2009)
1 parent 4fe2d11 commit 8fd7409

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

.changeset/dry-tips-do.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-email": patch
3+
---
4+
5+
Fix static files regression

packages/react-email/src/cli/utils/preview/serve-static-file.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@ export const serveStaticFile = async (
1414
const pathname = parsedUrl.pathname!;
1515
const ext = path.parse(pathname).ext;
1616

17-
const fileAbsolutePath = path.resolve(staticBaseDir, pathname);
18-
19-
if (!fileAbsolutePath.startsWith(staticBaseDir)) {
20-
res.statusCode = 403;
21-
res.end();
22-
return;
23-
}
17+
const fileAbsolutePath = path.join(staticBaseDir, pathname);
2418

2519
try {
2620
const fileHandle = await fs.open(fileAbsolutePath, 'r');

0 commit comments

Comments
 (0)