Repository navigation
Fix folder path escaping for names containing slashes - #1084
Merged
Merged
Conversation
Studio Pro allows '/' in a folder name, but BuildFolderPath joined names with a bare '/' and every folder-path walker split on it. A constant in `Private - String en/de-cryption` > `Apis` was described as folder 'Private - String en/de-cryption/Apis', and replaying the --save-edits output with exec filed it three folders deep, exit 0. New package mdl/folderpath: a '/' in a segment is written `\/`, a '\' `\\`; Split is lenient (a backslash before anything else stays literal), so existing paths keep their meaning. BuildFolderPath joins with it, resolveFolder / findFolderByPath / lookupFolder / the page builder and the project tree split with it. Describers that wrote `folder '%s'` unquoted now use mdlQuote, so the escape (and apostrophes) survive both string rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cj4DQ8PRitHdtF3q8pVVBQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issue mendixlabs#1367 where
marketplace update --save-editsfollowed byexeccorrupted folder paths containing literal/characters in folder names. The issue occurred because folder names were joined with bare/separators, making it impossible to distinguish between a single folder named"Private - String en/de-cryption"and two nested folders"Private - String en"and"de-cryption".Changes
New package
mdl/folderpath: Implements escaping and unescaping of folder path segmentsJoin(): Renders folder names as a path, escaping/as\/and\as\\within namesEscape(): Escapes a single folder nameSplit(): Parses a path back into folder names, treating\/and\\as escaped characters/or\is kept literal, preserving backward compatibility with hand-written pathsUpdated folder path handling across executor:
hierarchy.go:BuildFolderPath()now usesfolderpath.Join()to escape namescmd_folders.go,cmd_microflows_build.go,cmd_pages_builder.go,helpers.go: Updated to usefolderpath.Split()instead of naivestrings.Split()cmd_constants.go: Refactored to use newdescribeFolderClause()helperdocument_placement.go:describeFolderClause()now usesmdlQuote()for proper string literal quotingCLI integration (
cmd/mxcli/project_tree.go):getOrCreateFolder()now escapes folder names when building pathssplitFolderPath()delegates tofolderpath.Split()Documentation (
docs-site/src/reference/organization/create-folder.md):Test coverage:
mdl/folderpath/folderpath_test.go: Round-trip tests, backward compatibility, and edge casesmdl/executor/folder_path_slash_test.go: Integration test verifying describe→exec round-trip with slashes in folder namesmdl-examples/bug-tests/1367-folder-name-containing-slash.mdl: Reproducible test caseImplementation Details
The escape mechanism uses backslash (
\) as the escape character:\/inside a segment represents a literal/\\inside a segment represents a literal\This approach works across both MDL string literal quoting rules because
\/is unambiguous under both language versions. The escaping is at the path level, not the string literal level, soDESCRIBEoutput is properly round-trippable.https://claude.ai/code/session_01Cj4DQ8PRitHdtF3q8pVVBQ