Details
-
Bug
-
Resolution: Fixed
-
Critical
-
None
-
None
-
None
Description
Steps to reproduce
- Use any magnolia instance (for example jumpstart)
- Try adding an Asset via rest, like described in the documentation
https://docs.magnolia-cms.com/product-docs/6.2/Developing/How-to-add-an-asset-with-REST.html
Expected results
It should be possible to add Assets via rest
Actual results
The Asset is not added properly because the jcr:content node of the asset is saved as jcr-content.
Workaround
Development notes
I think the problem could maybe come with this commit from the latest version:
Because the colon is now an invalid character, jcr:content is saved as jcr-content.
I exported the file, renamed it back to jcr:content. After the reimport, the file was shown fine.
PM (Topher) Input
Do a little research why we escape : even though it's allowed character in JCR.
Valid (and actually required) node names are now being renamed to values that cause the system to work incorrectly. The reporter mentions the problem with the "jcr:content" name for assets. (It must be named "jcr:content"). I am not sure if this is the only case for Node names. I can see in linked docu page that there are also some required property names which have a colon, for example "jcr:data" or "jcr:mimeType".
It's challenging to decide on the proper behaviour because on one hand there are node names that require a colon, whereas when users use the UI colons are converted to dashes for the node name.
I propose the following:
Research what other requiired node names include a colon.
Checking if the node name in the REST request includes one of the known "required" names (such as 'jcr:content') and if so dont rename it. A more perissive but probably more future-proof approach would be to check if the node name inclues "jcr:" or "mgnl:" and if so, dont rename it.
The endpoint should return a message if a node has been renamed, and what its new name is. (otherwise the data on the client can get out of sync if it expects a certain name. Imagine the client has a system with 20 products and wants to import those items in Magnoila and maintiain "links" to them based on their names.)
The documentation should be updated to inform what are valid node names and what type of message is returned when invalid ones are supplied.
Checklists
Attachments
Issue Links
- is caused by
-
MGNLREST-343 Empty node name when using illegal characters
-
- Closed
-
- is causing
-
MGNLREST-347 DOC: What is a valid node name
-
- Closed
-
- is related to
-
MGNLREST-359 Cannot put nodes with colons in the name
-
- Closed
-
-
DOCU-2430 How to add an asset with REST tutorial is incomplete
-
- Closed
-