Fixed a few things lol
All checks were successful
Docker Deploy / build-and-push (push) Successful in 4m11s
All checks were successful
Docker Deploy / build-and-push (push) Successful in 4m11s
This commit is contained in:
@@ -9,19 +9,18 @@ export const GET: APIRoute = async ({ params }) => {
|
||||
return new Response("Not found", { status: 404 });
|
||||
}
|
||||
|
||||
let uploadDir;
|
||||
const dataDir = process.env.DATA_DIR
|
||||
? process.env.DATA_DIR
|
||||
: import.meta.env.DATA_DIR;
|
||||
|
||||
const envRootDir = process.env.ROOT_DIR
|
||||
? process.env.ROOT_DIR
|
||||
: import.meta.env.ROOT_DIR;
|
||||
|
||||
if (envRootDir) {
|
||||
uploadDir = path.join(envRootDir, "uploads");
|
||||
} else {
|
||||
uploadDir =
|
||||
process.env.UPLOAD_DIR || path.join(process.cwd(), "public", "uploads");
|
||||
if (!dataDir) {
|
||||
return new Response("DATA_DIR environment variable is not set", {
|
||||
status: 500,
|
||||
});
|
||||
}
|
||||
|
||||
const uploadDir = path.join(dataDir, "uploads");
|
||||
|
||||
const safePath = path.normalize(filePathParam).replace(/^(\.\.[\/\\])+/, "");
|
||||
const fullPath = path.join(uploadDir, safePath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user