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 3 commits 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 <noreply@anthropic.com>
|
Claude finished @adrianjm-dotCMS's task in 3m 4s —— View job PR Review
Clean fix. A few things worth noting: JSP fix ( The core change is correct and consistent. Page object (
async goToNewWithFolderPath(contentType: string, folderPath: string, readyTestId = 'title') {
await this.page.goto(`/dotAdmin/#/content/new/${contentType}?folderPath=${folderPath}`);
await this.page.waitForLoadState('domcontentloaded');
await this.page.getByTestId(readyTestId).waitFor({ state: 'visible', timeout: 15000 });
}Not a bug, but the duplication will drift if the navigation logic changes. Fix this → E2E spec (
No functional bugs, security issues, or missing edge cases found. |
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). |
- Move goToNewFileAssetWithFolderPath() to NewEditContentFormPage so the URL pattern lives in one place (waits for field-hostFolder instead of title, which file asset types do not expose) - Add afterEach to delete the test content type and avoid data accumulation - Remove the local navigateToNewFileAsset helper replaced by the page object Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 #35322VIDEO
Screen.Recording.2026-04-30.at.9.57.36.AM.mov
Related
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