[MGNLUI-4298] Get item by url fragment does not return proper item when rootPath is configured in JcrContentConnector Created: 02/Oct/17 Updated: 08/Mar/21 Resolved: 08/Mar/21 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | None |
| Affects Version/s: | 5.5.6 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Sang Ngo Huu | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||
| Description |
|
There is a problem in line String fullFragment = ("/".equals(getRootPath()) ? "" : getRootPath()) + urlFragment; So It causes a problem in choose dialog: item is not re-selected when open choose dialog in linkField
@Override
public JcrItemId getItemIdByUrlFragment(String urlFragment) {
try {
String fullFragment = ("/".equals(getRootPath()) ? "" : getRootPath()) + urlFragment;
String nodePath = JcrItemUtil.parseNodeIdentifier(fullFragment);
nodePath = !StringUtils.isBlank(nodePath) ? nodePath : getRootPath();
JcrItemId nodeItemId = JcrItemUtil.getItemId(getWorkspace(), nodePath);
if (nodeItemId == null || !JcrItemUtil.isPropertyItemId(fullFragment)) {
return nodeItemId;
} else {
return new JcrPropertyItemId(nodeItemId, parsePropertyName(fullFragment));
}
} catch (RepositoryException e) {
log.error("Failed to obtain JCR id for fragment: " + e.getMessage(), e);
return null;
}
}
|