Fix errors, bugs and known vulerabilities
This commit is contained in:
@@ -15,6 +15,10 @@ export default async function ({ req }: Params): Promise<Response> {
|
||||
const url = new URL(req.url);
|
||||
const file_path = path.join(PUBLIC_DIR, url.pathname);
|
||||
|
||||
if (!file_path.startsWith(PUBLIC_DIR + path.sep)) {
|
||||
return new Response("Forbidden", { status: 403 });
|
||||
}
|
||||
|
||||
if (!existsSync(file_path)) {
|
||||
return new Response(`File Doesn't Exist`, {
|
||||
status: 404,
|
||||
|
||||
Reference in New Issue
Block a user