fix(browser): pass folderPath when creating file asset from Site Browser#35507
fix(browser): pass folderPath when creating file asset from Site Browser#35507adrianjm-dotCMS wants to merge 1 commit intomainfrom
Conversation
When opening the Add File Asset dialog from a nested folder in Site Browser, folderPath was not passed to createContentlet(), causing the new Angular edit-content form to always default Host/Folder to site root. Stores the active folderMap in currentFileAssetFolderMap (mirroring the existing currentPageAssetFolderMap pattern used for HTML pages) and passes the resolved folderPath to createContentlet() in the single-file branch of getSelectedfileAsset. Adds E2E coverage for FileAsset content type folderPath pre-fill, complementing the SimpleContentType specs added in PR #35322. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Claude finished @adrianjm-dotCMS's task in 2m 44s —— View job PR Review
|
There was a problem hiding this comment.
Pull request overview
Fixes Site Browser “Add Asset → File” creation so the Angular edit-content form receives the correct folderPath for nested folders (regression noted in TC-004 / issue #34588), and adds E2E coverage to prevent recurrence.
Changes:
- Persist the active folder context for file assets (
currentFileAssetFolderMap) when opening the “Add File Asset” popup. - Pass the resolved
folderPathintocreateContentlet()for the single-file asset creation path (mirrors existing HTML page behavior). - Add Playwright E2E specs validating
folderPathpre-fill for File Asset content types (hostFolderfield variable).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
dotCMS/src/main/webapp/html/portlet/ext/browser/view_browser_js_inc.jsp |
Captures the current folder context for file assets and forwards folderPath into the Angular create-contentlet event payload. |
core-web/apps/dotcms-ui-e2e/src/tests/edit-content/fields/host-folder-field/host-folder-field-file-asset.spec.ts |
Adds E2E coverage ensuring folderPath query param pre-fills Host/Folder for File Asset types (nested, shallow, empty fallback). |
| async function navigateToNewFileAsset( | ||
| adminPage: import('@playwright/test').Page, | ||
| contentType: string, | ||
| folderPath: string | ||
| ) { | ||
| await adminPage.goto(`/dotAdmin/#/content/new/${contentType}?folderPath=${folderPath}`); | ||
| await adminPage.waitForLoadState('domcontentloaded'); | ||
| await adminPage | ||
| .getByTestId('field-hostFolder') | ||
| .waitFor({ state: 'visible', timeout: 15000 }); | ||
| } |
Summary
folderPathwas not passed tocreateContentlet(), so the new Angular edit-content form always defaulted the Host/Folder field to site root instead of the current folderfolderMapincurrentFileAssetFolderMapinsideshowFileAssetPopUp— mirroring the existingcurrentPageAssetFolderMappattern already in place for HTML pagesfolderPathtocreateContentlet()in the single-file branch ofgetSelectedfileAssetFileAssetContentTypefolderPathpre-fill (field variablehostFolder), complementing theSimpleContentTypespecs added in PR feat(dot-custom-event-handler): enhance contentlet creation with folder #35322Related
Closes #34588
Test plan
folder-1/folder-2)?folderPath=<site>/folder-1/folder-2/in the URL and Host/Folder field pre-filled correctlyfolder-2, not at site root🤖 Generated with Claude Code