Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix: decode multer filename encoding for non-ASCII filenames

ASTERISK Kwon9f1b0554d6a6
diff --git a/server/src/routes/collab.ts b/server/src/routes/collab.ts
index 3c5d6b252..0c908e50b 100644
--- a/server/src/routes/collab.ts
+++ b/server/src/routes/collab.ts
@@ -39,6 +39,7 @@ const noteUpload = multer({
filename: (_req, file, cb) => { cb(null, `${uuidv4()}${path.extname(file.originalname)}`) },
}),
limits: { fileSize: MAX_NOTE_FILE_SIZE },
+ defParamCharset: 'utf8',
fileFilter: (_req, file, cb) => {
const ext = path.extname(file.originalname).toLowerCase();
const BLOCKED = ['.svg', '.html', '.htm', '.xml', '.xhtml', '.js', '.jsx', '.ts', '.exe', '.bat', '.sh', '.cmd', '.msi', '.dll', '.com', '.vbs', '.ps1', '.php'];
diff --git a/server/src/routes/files.ts b/server/src/routes/files.ts
index a48c2d4dc..df568648e 100644
--- a/server/src/routes/files.ts
+++ b/server/src/routes/files.ts
@@ -38,6 +38,7 @@ function getAllowedExtensions(): string {
const upload = multer({
storage,
limits: { fileSize: MAX_FILE_SIZE },
+ defParamCharset: 'utf8',
fileFilter: (_req, file, cb) => {
const ext = path.extname(file.originalname).toLowerCase();
if (BLOCKED_EXTENSIONS.includes(ext) || file.mimetype.includes('svg')) {