{"record":{"id":"400feccbdde160e6","repo":"iflytek/astron-agent","slug":"repo-folder-name-illegal","errorCode":"REPO_FOLDER_NAME_ILLEGAL","errorMessage":"REPO_FOLDER_NAME_ILLEGAL","messagePattern":"REPO_FOLDER_NAME_ILLEGAL","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java","lineNumber":1891,"sourceCode":"        return pageData;\n    }\n\n    /**\n     * Create a new folder in the repository\n     *\n     * @param folderVO folder creation parameters containing name, repository ID, and parent ID\n     * @throws BusinessException if folder name is empty, contains illegal characters, or repository\n     *         access is denied\n     */\n    public void createFolder(CreateFolderVO folderVO) {\n        String name = folderVO.getName();\n        Pattern pattern = Pattern.compile(\"[\\\\\\\\/:*?\\\"<>|]\");\n        if (ObjectIsNull.check(name)) {\n            throw new BusinessException(ResponseEnum.REPO_FILE_NAME_CANNOT_EMPTY);\n        } else {\n            boolean flag = pattern.matcher(name).find();\n            if (flag) {\n                throw new BusinessException(ResponseEnum.REPO_FOLDER_NAME_ILLEGAL);\n            }\n        }\n        Long parentId = folderVO.getParentId();\n\n        Repo repo = repoService.getById(folderVO.getRepoId());\n        if (repo != null) {\n            dataPermissionCheckTool.checkRepoBelong(repo);\n        }\n\n        FileDirectoryTree fileDirectoryTree;\n        // Non-empty means a folder with the same name exists in the same directory, user creation is not\n        // allowed\n        /*\n         * if (!ObjectIsNull.check(fileDirectoryTree)) { throw new\n         * CustomException(\"Folders with the same name are not allowed in the current directory\"); }\n         */\n        fileDirectoryTree = new FileDirectoryTree();\n        fileDirectoryTree.setIsFile(0);","sourceCodeStart":1873,"sourceCodeEnd":1909,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java#L1873-L1909","documentation":"createFolder also checks the folder name against the regex [\\\\/:*?\"<>|]; if any of these characters is present it throws BusinessException(REPO_FOLDER_NAME_ILLEGAL). These are filesystem-reserved characters, so names containing them are rejected to keep the directory tree safe and portable.","triggerScenarios":"Calling createFolder with a name containing any of \\ / : * ? \" < > | — e.g. \"a/b\", \"doc:v2\", \"report?final\" — usually from paste-in content or filename-like input.","commonSituations":"User pastes a Windows file path or timestamped string (\"2026/09/12\") into the folder name field; bulk-import scripts derive names from file paths; locale input containing ':' as a separator.","solutions":["Remove or replace the reserved characters (\\ / : * ? \" < > |) from the folder name.","Sanitize/normalize the name client-side (e.g. replace illegal chars with '-') before submitting.","Show the allowed-character rule in the UI next to the input field to prevent bad submissions."],"exampleFix":"// before\nvo.setName(\"2026/09/report\"); // contains '/'\n// after\nvo.setName(\"2026-09-report\");","handlingStrategy":"validation","validationCode":"Pattern ILLEGAL = Pattern.compile(\"[\\\\\\\\/:*?\\\"<>|]\");\nif (name != null && ILLEGAL.matcher(name).find()) {\n    // reject or auto-sanitize before calling createFolder\n    name = ILLEGAL.matcher(name).replaceAll(\"-\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    fileInfoV2Service.createFolder(vo);\n} catch (BusinessException e) {\n    if (\"REPO_FOLDER_NAME_ILLEGAL\".equals(e.getCode())) {\n        // show allowed-characters hint next to the input\n    }\n}","preventionTips":["Mirror the server's illegal-character regex in the client input filter.","Sanitize pasted paths/timestamps automatically (replace reserved chars with '-').","Document the naming rule where users create folders."],"tags":["validation","invalid-argument-value","filename"],"backgroundTag":"invalid-argument-value","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}