octobercms/october · warning · ApplicationException
editor::lang.filesystem.directory_name_cant_be_empty
Error message
editor::lang.filesystem.directory_name_cant_be_empty
What it means
FileSystemFunctions::editorCreateDirectory validates the 'new directory' request made from the backend code editor. If the submitted new name is empty after checks, this ApplicationException (editor::lang.filesystem.directory_name_cant_be_empty) is returned. It is a user-input guard that fires before any path validation or filesystem access happens.
Source
Thrown at modules/editor/traits/FileSystemFunctions.php:27
use ApplicationException;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* FileSystemFunctions implements common file and directory management functions for Tailor extensions.
*/
trait FileSystemFunctions
{
/**
* editorCreateDirectory
*/
protected function editorCreateDirectory($basePath, $newName, $parent)
{
if (!strlen($basePath)) {
throw new SystemException('The directory base path must not be empty');
}
if (!strlen($newName)) {
throw new ApplicationException(Lang::get('editor::lang.filesystem.directory_name_cant_be_empty'));
}
if (!$this->validateFileSystemPath($newName)) {
throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_path'));
}
if (strlen($parent) && !$this->validateFileSystemPath($parent)) {
throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_path'));
}
if (!$this->validateFileSystemName($newName)) {
throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_name'));
}
$newFullPath = $basePath.'/'.$parent.'/'.$newName;
if (file_exists($newFullPath) && is_dir($newFullPath)) {
throw new ApplicationException(Lang::get('editor::lang.filesystem.already_exists'));
}View on GitHub (pinned to b608633a7e)
Solutions
- Provide a non-empty directory name in the request.
- Add required-field client validation on the new-folder dialog before submitting.
- Trim the input in the caller so whitespace-only names are caught client-side.
- Verify the request parameter name matches what the editor API expects (newName).
Example fix
// before
$request->input('newName') === '';
// after
if (!strlen(trim($name))) {
// show client-side message instead of posting
} Defensive patterns
Strategy: validation
Validate before calling
$name = trim((string) $newName);
if ($name === '') {
throw new \ValidationException(['name' => 'Directory name cannot be empty']);
} Prevention
- Make the new-folder input required in the editor UI.
- Trim input before submitting.
- Reject empty names client-side so the user never sees the server error.
When it happens
Trigger: POSTing a create-directory request to the editor controller with an empty newName; a custom editor integration that submits the form before the name field is filled; whitespace-only name that PHP casts to empty.
Common situations: Front-end bug letting the 'new folder' dialog submit with no input; automated scripts calling the editor API without the name parameter; browser autofill or JS errors clearing the field.
Related errors
- editor::lang.filesystem.invalid_name
- editor::lang.filesystem.name_cant_be_empty
- editor::lang.filesystem.type_not_allowed
- editor::lang.filesystem.error_deleting_dir_not_empty
- editor::lang.filesystem.selected_files_not_found
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/9fe74fb3b77b4519.
Report an issue: GitHub.