From ebe5ddb09319ef44bbdbf5c6a2f0b75e4fb7f184 Mon Sep 17 00:00:00 2001 From: Pau Date: Thu, 15 May 2025 01:21:23 +0200 Subject: [PATCH] fixed upload directory path use in app --- src/index.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/index.js b/src/index.js index 01ca22d..124c19d 100644 --- a/src/index.js +++ b/src/index.js @@ -10,11 +10,6 @@ import routes from './routes/index.js' import router from './routes/uploadRoutes.js' import { error404, errorHandler } from './utils/errors.js' import { getRoutes } from './utils/links.js' -import { fileURLToPath } from 'node:url' -import { dirname } from 'node:path' - -const __filename = fileURLToPath(import.meta.url) -const __dirname = dirname(__filename) const app = express() dayjs.extend(utc) @@ -60,7 +55,7 @@ const linkRoutes2 = { ...links2 } app.use('/', r1, r2) -app.use('/public', express.static(path.join(__dirname, 'uploads'))); +app.use('/public', express.static(path.resolve(process.cwd(), config.uploadDir))); // APPLICATION LAUNCHER ------------------------------------------------------------------ // 404 - Not found