Uploaded image for project: 'Magnolia REST Framework'
  1. Magnolia REST Framework
  2. MGNLREST-349

Creating asset via rest is not possible anymore

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 2.2.12
    • None
    • None
    • None

      Steps to reproduce

      1. Use any magnolia instance (for example jumpstart)
      2. 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:

      https://git.magnolia-cms.com/projects/MODULES/repos/rest/commits/f9cd00ffd4349e62cb9e8ede62bf01bc1648381c#magnolia-rest-services/src/main/java/info/magnolia/rest/service/node/v1/NodeEndpoint.java

      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.

       

       

        Acceptance criteria

              mdivilek Milan Divilek
              tobias.kerschbaum Tobias Kerschbaum
              DeveloperX
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD