{"record":{"id":"18f53a99b55ded6d","repo":"octobercms/october","slug":"editor-lang-filesystem-select-destination-dir","errorCode":null,"errorMessage":"editor::lang.filesystem.select_destination_dir","messagePattern":"editor::lang\\.filesystem\\.select_destination_dir","errorType":"validation","errorClass":"ApplicationException","httpStatus":null,"severity":"warning","filePath":"modules/editor/traits/FileSystemFunctions.php","lineNumber":168,"sourceCode":"                            ['name' => $path]\n                        ));\n                    }\n                }\n            }\n        }\n    }\n\n    /**\n     * editorMoveFilesOrDirectories\n     */\n    protected function editorMoveFilesOrDirectories($basePath, $selectedList, $destinationDir)\n    {\n        if (!count($selectedList)) {\n            throw new ApplicationException(Lang::get('editor::lang.filesystem.selected_files_not_found'));\n        }\n\n        if (!strlen($destinationDir)) {\n            throw new ApplicationException(Lang::get('editor::lang.filesystem.select_destination_dir'));\n        }\n\n        if (!$this->validateFileSystemPath($destinationDir)) {\n            throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_path'));\n        }\n\n        // Ensure directory exists\n        $destinationFullPath = $basePath.'/'.$destinationDir;\n        if (!File::isDirectory($destinationFullPath)) {\n            File::makeDirectory($destinationFullPath, 0755, true, true);\n        }\n\n        // Path is gone\n        if (!file_exists($destinationFullPath) || !is_dir($destinationFullPath)) {\n            throw new ApplicationException(Lang::get('editor::lang.filesystem.destination_not_found'));\n        }\n\n        foreach ($selectedList as $path) {","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/editor/traits/FileSystemFunctions.php#L150-L186","documentation":"Thrown by editorMoveFilesOrDirectories when $destinationDir is an empty string (lines 167-169). Message: 'Please select a destination directory'. It is the second pure precondition of the move command: moving requires an explicit destination, and even the assets root must be sent as '/', not ''.","triggerScenarios":"command_onAssetMove with documentData 'destination' => '' — typically a custom client encoding the root directory as an empty string, or a drag handler that resolves 'dropped on root' to '' instead of '/'.","commonSituations":"Custom integrations and tests replaying editor commands; modified/extension sidebar code where the root node's path property is empty; payloads built from trim()-ed user input that becomes ''.","solutions":["Send '/' when moving to the assets root instead of an empty string","Re-do the drag-and-drop onto a visible directory node in the sidebar","In custom clients, default destination to '/' when the user picks the tree root","Check the network request to confirm 'destination' is present and non-empty"],"exampleFix":"// before\n{ \"source\": [\"css/a.css\"], \"destination\": \"\" }\n// after\n{ \"source\": [\"css/a.css\"], \"destination\": \"/\" }","handlingStrategy":"validation","validationCode":"$destinationDir = trim((string) $destination);\nif ($destinationDir === '') {\n    $destinationDir = '/'; // assets root must be '/', never empty\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Encode the assets root as '/', not an empty string","Default destination to '/' in custom clients when the tree root is chosen","Keep the drag handler's root-node path property set to '/'"],"tags":["filesystem","validation","request-payload","editor","winter-cms"],"backgroundTag":"missing-request-parameter","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}