A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix: Sanitize uploaded file names. #1765
MohamedBassem39a650f63484
diff --git a/packages/api/utils/upload.ts b/packages/api/utils/upload.tsindex 7e322c76..970323fd 100644--- a/packages/api/utils/upload.ts+++ b/packages/api/utils/upload.ts@@ -62,7 +62,8 @@ export async function uploadAsset(}const contentType = data.type;- const fileName = data.name;+ // Replace all non-ascii characters with underscores+ const fileName = data.name.replace(/[^\x20-\x7E]/g, "_");if (!SUPPORTED_UPLOAD_ASSET_TYPES.has(contentType)) {return { error: "Unsupported asset type", status: 400 };}