{"record":{"id":"c0f18180fbf6368a","repo":"octobercms/october","slug":"editor-lang-filesystem-invalid-name","errorCode":null,"errorMessage":"editor::lang.filesystem.invalid_name","messagePattern":"editor::lang\\.filesystem\\.invalid_name","errorType":"validation","errorClass":"ApplicationException","httpStatus":null,"severity":"warning","filePath":"modules/editor/traits/FileSystemFunctions.php","lineNumber":39,"sourceCode":"    {\n        if (!strlen($basePath)) {\n            throw new SystemException('The directory base path must not be empty');\n        }\n\n        if (!strlen($newName)) {\n            throw new ApplicationException(Lang::get('editor::lang.filesystem.directory_name_cant_be_empty'));\n        }\n\n        if (!$this->validateFileSystemPath($newName)) {\n            throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_path'));\n        }\n\n        if (strlen($parent) && !$this->validateFileSystemPath($parent)) {\n            throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_path'));\n        }\n\n        if (!$this->validateFileSystemName($newName)) {\n            throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_name'));\n        }\n\n        $newFullPath = $basePath.'/'.$parent.'/'.$newName;\n        if (file_exists($newFullPath) && is_dir($newFullPath)) {\n            throw new ApplicationException(Lang::get('editor::lang.filesystem.already_exists'));\n        }\n\n        if (!File::makeDirectory($newFullPath, 0755, true, true)) {\n            throw new ApplicationException(Lang::get(\n                'editor::lang.filesystem.error_creating_directory',\n                ['name' => $newName]\n            ));\n        }\n    }\n\n    /**\n     * editorRenameFileOrDirectory\n     */","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/editor/traits/FileSystemFunctions.php#L21-L57","documentation":"After path validation, editorCreateDirectory runs validateFileSystemName() on the new name. This is stricter than the path validator: it allows only /^[\\@0-9a-z.\\s_-]+$/i - crucially no slash - and rejects '..'. So a name that looks like a path (contains '/') fails with editor::lang.filesystem.invalid_name.","triggerScenarios":"Submitting 'assets/partials' as the directory name (slash not allowed in a name); a name containing characters such as '#', '&', parentheses; a name that includes '..' even as part of something like 'my..dir'.","commonSituations":"Users entering a full relative path in the single name field instead of using the parent field; names with special characters from copy-paste; non-latin alphabet names.","solutions":["Split the value: last segment goes in newName, the rest goes in parent.","Remove characters outside letters, digits, dot, space, underscore, hyphen and '@'.","Transliterate non-ASCII names before submission.","Add a client-side pattern check matching ^[@0-9a-zA-Z.\\s_-]+$ on the input."],"exampleFix":"// before\nnewName: 'assets/partials', parent: ''\n\n// after\nnewName: 'partials', parent: 'assets'","handlingStrategy":"validation","validationCode":"/** Editor name rule: no slash, no '..', whitelist chars only. */\nfunction isValidEditorName(string $name): bool\n{\n    if (!preg_match('/^[\\@0-9a-z\\.\\s_\\-]+$/i', $name)) {\n        return false;\n    }\n    return strpos($name, '..') === false;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Split paths into name and parent before submitting.","Enforce the no-slash rule in the input field pattern.","Show allowed characters hint in the create-folder dialog."],"tags":["editor","filesystem","name-validation","input"],"backgroundTag":"invalid-filename","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}