Repository navigation
bug/1781: fix folder path when folder name contains slash character - #2534
Conversation
Co-authored-by: JoernBerkefeld <[email protected]>
Coverage ReportCommit:c5beb7dBase: develop@fa01840
Details (changed files):
|
JoernBerkefeld
left a comment
There was a problem hiding this comment.
@copilot please have a look at my review except for the the one on asset.js which need to be tested by me
| ` %%= ContentBlockByName("${ | ||
| json.folder | ||
| .split('/') | ||
| .map((s) => s.replaceAll(Util.folderNameSlashEscapeChar, '/')) |
There was a problem hiding this comment.
Need to be tested how this really works. We might need to keep the forward sladh in that situation
There was a problem hiding this comment.
Understood — skipping this one for you to test. The current code unescapes ∕ → / per path segment before building the ContentBlockByName hint string, so the displayed path would use the real slash matching what SFMC expects. Happy to adjust once you've verified the actual behavior.
| "description": "created on deploy", | ||
| "key": "testNew_slashFolderScript", | ||
| "name": "testNew_slashFolderScript", | ||
| "r__folder_Path": "Scripts/Headers\u2215Folders" |
There was a problem hiding this comment.
This is not wanted like that. The unicode char needs to be rendered
There was a problem hiding this comment.
Fixed in b8f0916 — the test fixture now contains the actual rendered ∕ character (U+2215, UTF-8 bytes e2 88 95) rather than the \u2215 JSON escape sequence, matching how fs.writeJSON writes the character in real retrieved files.
Co-authored-by: JoernBerkefeld <[email protected]>
Co-authored-by: JoernBerkefeld <[email protected]>
…oyFolderTypesAssetRest Co-authored-by: JoernBerkefeld <[email protected]>
SFMC's SOAP
DataFoldercreate/update API silently strips/from folder names, making it unsuitable forassetandasset-sharedfolder types. The/asset/v1/content/categoriesREST endpoint preserves them. This PR routes those two types through REST (same ascloudpagesalready was) and replaces the now-incorrect script-based slash-folder tests with asset-based equivalents.Changes
lib/metadataTypes/definitions/Folder.definition.jsdeployFolderTypesAssetRest: ['cloudpages']→['cloudpages', 'asset', 'asset-shared']PUT/POST /asset/v1/content/categoriestest/type.folder.test.js/, so those tests were validating incorrect behavior)folder-deploy-slashandfolder-deploy-samepathassertions: SOAP callout checks → REST callout checksbla/blub→r__folder_Pathstored as"Content Builder/bla∕blub"(U+2215 escape)r__folder_Path: "Content Builder/bla∕blub"triggers REST folder create withname: "bla/blub"(real slash, not escape char)New test fixtures
asset/v1/content/categories/post-response.jsonasset/v1/content/assets/post-response-key=test_slash.jsonasset/v1/content/assets/16992/get-response.jsontest_slashasset/v1/content/assets/query/+post-response-…-slashfolder.jsontest_slashdataFolder/+retrieve-ContentTypeINasset,asset-shared,cloudpages-slashfolder-response.xmlbla/blub(real slash in<Name>)asset-slashfolder-deploy/block/test_slash.*Deleted
All script-slashfolder fixtures (
script-slashfolder-deploy/,script/get_slashfolder-expected.*,+retrieve-ContentType=ssjsactivity-slashfolder-response.xml,+get-slashfolder-response.json).Documentation
deployFolderTypesAssetRestinFolder.definition.jsnow coversassetandasset-sharedin addition tocloudpages. Folders of these types are created/updated viaPOST/PUT /asset/v1/content/categories. The∕(U+2215) escape inr__folder_Pathis preserved for retrieve; deploy unescapes to the real/before sending to the API.Release details
Checklist
Before merge
npm run prepare-release(which runsnpm audit fix,npm run lint-ts,npm run lint:fix,git add,git commit)After merge
npm run version:major/minor/patchOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.