feat: implement template storage and download functionality with Docker support
This commit is contained in:
@@ -4,7 +4,7 @@ import { existsSync } from "fs";
|
||||
import path from "path";
|
||||
import db from "@/lib/db";
|
||||
|
||||
const TEMPLATES_DIR = path.join(process.cwd(), "public", "templates");
|
||||
const TEMPLATES_DIR = path.join(process.cwd(), "templates");
|
||||
const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MB
|
||||
const ALLOWED_TYPES = [
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
@@ -49,7 +49,7 @@ export async function POST(request) {
|
||||
const sanitizedOriginalName = file.name.replace(/[^a-zA-Z0-9.-]/g, "_");
|
||||
const storedFilename = `${timestamp}_${sanitizedOriginalName}`;
|
||||
const filePath = path.join(TEMPLATES_DIR, storedFilename);
|
||||
const relativePath = `/templates/${storedFilename}`;
|
||||
const relativePath = `templates/${storedFilename}`;
|
||||
|
||||
// Save file
|
||||
const bytes = await file.arrayBuffer();
|
||||
|
||||
Reference in New Issue
Block a user