{"record":{"id":"f3a4bfe5b1915d7f","repo":"Mintplex-Labs/anything-llm","slug":"invalid-file-name-please-choose-a-different-file","errorCode":null,"errorMessage":"Invalid file name. Please choose a different file.","messagePattern":"Invalid file name\\. Please choose a different file\\.","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/endpoints/system.js","lineNumber":974,"sourceCode":"      }\n    }\n  );\n\n  app.post(\n    \"/system/upload-logo\",\n    [\n      validatedRequest,\n      flexUserRoleValid([ROLES.admin, ROLES.manager]),\n      handleAssetUpload,\n    ],\n    async (request, response) => {\n      if (!request?.file || !request?.file.originalname) {\n        return response.status(400).json({ message: \"No logo file provided.\" });\n      }\n\n      if (!validFilename(request.file.originalname)) {\n        return response.status(400).json({\n          message: \"Invalid file name. Please choose a different file.\",\n        });\n      }\n\n      try {\n        const newFilename = await renameLogoFile(request.file.originalname);\n        const existingLogoFilename = await SystemSettings.currentLogoFilename();\n        await removeCustomLogo(existingLogoFilename);\n\n        const { success, error } = await SystemSettings._updateSettings({\n          logo_filename: newFilename,\n        });\n\n        return response.status(success ? 200 : 500).json({\n          message: success\n            ? \"Logo uploaded successfully.\"\n            : error || \"Failed to update with new logo.\",\n        });\n      } catch (error) {","sourceCodeStart":956,"sourceCodeEnd":992,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/20f6d3546c1938bfea1ad304f58a592dddcc5948/server/endpoints/system.js#L956-L992","documentation":"Validation on POST /system/upload-logo: the uploaded file's original name failed the validFilename check (unsafe characters, path traversal, or disallowed extension), so the file is refused with HTTP 400 to prevent writing a malicious or unusable asset.","triggerScenarios":"Thrown at server/endpoints/system.js:960 when the library encounters an invalid state.","commonSituations":"The uploaded logo filename failed validation.","solutions":["Rename the file to use a safe name (no path separators or special characters).","Use a common image filename like 'logo.png'."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"20f6d3546c1938bfea1ad304f58a592dddcc5948","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}