[MGNLREST-349] Creating asset via rest is not possible anymore Created: 04/Feb/22 Updated: 23/Oct/23 Resolved: 01/Mar/22 |
|
| Status: | Closed |
| Project: | Magnolia REST Framework |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.2.12 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Tobias Kerschbaum | Assignee: | Milan Divilek |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Template: |
|
||||||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||||||||||
| Task DoD: |
[X]*
Doc/release notes changes? Comment present?
[X]*
Downstream builds green?
[X]*
Solution information and context easily available?
[X]*
Tests
[X]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||||||||||
| Epic Link: | Headless Phase 2 | ||||||||||||||||||||||||||||
| Sprint: | DevX 4 | ||||||||||||||||||||||||||||
| Story Points: | 5 | ||||||||||||||||||||||||||||
| Team: | |||||||||||||||||||||||||||||
| Description |
Steps to reproduce
Expected resultsIt should be possible to add Assets via rest Actual resultsThe Asset is not added properly because the jcr:content node of the asset is saved as jcr-content. WorkaroundDevelopment notesI 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. PM (Topher) InputDo 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.
|
| Comments |
| Comment by Milan Divilek [ 18/Feb/22 ] |
|
Colons is invalid character in JCR Local Names.
JCR name is composed of JCR namespace and JCR local name and colon is used as delimiter.
For example: "jcr:content"
Namespace: jcr
Local Name: content
Solution: |