Yegor Kozlov created SLING-11891:
------------------------------------

             Summary: SlingPostServlet: Support importing binary data from json
                 Key: SLING-11891
                 URL: https://issues.apache.org/jira/browse/SLING-11891
             Project: Sling
          Issue Type: Improvement
          Components: Servlets
            Reporter: Yegor Kozlov


I would like to improve symmetry between export and import in Sling GET/POST 
servlets. 

So far, JSON Renderer in Sling GET Servlet marked binary properties with an 
initial colon in their name and dumped the length instead of the data .
{code}
{
  "jcr:primaryType": "nt:resource",
  ":jcr:data": 20127
}
{code}

SlingPostServlet fails to import it since colon is not allowed as a JCR 
property name which is fine. I'd like to extend the logic, and if a property 
starts with a colon and it is not LONG then it would mean it carries base64 
data:

{code}
{
  "jcr:primaryType": "nt:resource",
  ":jcr:data": "iVBORw0KGgoA...."
}
{code}

JSON importer would make sense of it and convert the base64 into a binary node 
property.

The PR is coming.





--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to