-
Improvement
-
Resolution: Unresolved
-
Neutral
-
None
-
2.2.1
-
mgnl-6.2.2
-
-
Empty show more show less
-
Yes
-
Yes
-
Yes
reproduce steps
1. create a text component
form: properties: text: label: Text $type: richTextField
2.
add the component to a page and maintain a link
3.
Do a request against the delivery API: http://localhost:8080/author/.rest/delivery/pages/v1/demo-content
The response is:
"main": { "@name": "main", "@path": "/demo-content/main", "@id": "ceecf6c7-8a5c-48e1-a5d8-2dda9e5a0dfe", "@nodeType": "mgnl:area", "0": { "@name": "0", "@path": "/demo-content/main/0", "@id": "86c4e0a6-159d-4911-b589-4f6e2888e15c", "@nodeType": "mgnl:component", "text": "<p><a href=\"${link:{uuid:{943d6ee7-f6a5-4be0-9fb9-415b59b95523},repository:{website},path:{/demo-content/inhlatsseite}}}\">test</a></p>\n", "mgnl:template": "test:components/text", "@nodes": [] }, "@nodes": ["0"] }
expected result
I would expect a real page link.
actual result
described above
implementation notes
The functionality I added is from the ContentMap. For freemarker, the links ware resolved there.
Would be better if we can have a flag in the endpoint definition for this function, true by default. Things like resolve references taking a number of depth.
Customer notes
Possible Solution:
private String getValueString(Value value) throws RepositoryException { switch (value.getType()) { case PropertyType.BINARY: return getBinaryString(value); case PropertyType.DECIMAL: return String.valueOf(value.getDecimal()); case PropertyType.NAME: case PropertyType.URI: case PropertyType.DATE: return value.getString(); default: return getStringValue(value); } } public String getStringValue(final Value value) { String result = PropertyUtil.getValueString(value); if (LinkUtil.UUID_PATTERN.matcher(result).find()) { try { result = info.magnolia.link.LinkUtil.convertLinksFromUUIDPattern(result); } catch (LinkException e) { LOGGER.warn("Failed to parse links with from {}", result, e); } } return result; }
Acceptance criteria