Details
-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
7.13.2
-
None
-
2
-
Severity 3 - Minor
-
1
-
Description
Issue Summary
What the customer is doing is using GET to fetch information from a source page and POST to create a new target page(copy source page to target page). There is an image in source page.
GET /rest/api/content/11111111?spaceKey=TEST&expand=body.view
There is no closing tag(</img>) for image return, the part is as below:
"value":"<p><br/></p><p><span class=\"confluence-embedded-file-wrapper confluence-embedded-manual-size\"><img class=\"confluence-embedded-image\" height=\"250\" src=\"/download/attachments/851970/search.png?version=1&modificationDate=1652361818747&api=v2\" data-image-src=\"/download/attachments/851970/search.png?version=1&modificationDate=1652361818747&api=v2\" data-unresolved-comment-count=\"0\" data-linked-resource-id=\"1179650\" data-linked-resource-version=\"1\" data-linked-resource-type=\"attachment\" data-linked-resource-default-alias=\"search.png\" data-base-url=\"http://test:18090\" data-linked-resource-content-type=\"image/png\" data-linked-resource-container-id=\"851970\" data-linked-resource-container-version=\"4\"></span></p>"
The problem is if using the above information (fetching from GET API) to create target page(without </img>), an error occurred.
POST /rest/api/content/
{"statusCode":400,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"Error parsing xhtml: Unexpected close tag </span>; expected </img>.\n at [row,col {unknown-source}]: [1,1084]","reason":"Bad Request"}%
Also, if appending </img>, the page will be created without error.
This is reproducible on Data Center: (yes) / (no)
Steps to Reproduce
- Create a page, attach a image(search.png).
- Using get for API (/rest/api/content) to fetch the page created.
- Copy the part of image into a file( data.json), and using this file to create new page.
- Run POST REST API to create page
curl -u admin:abc -X POST -H 'Content-Type: application/json' -d '@data.json' "http://myconfluence:8090/rest/api/content"
Expected Results
The page will be created.
Actual Results
The page cannot be created.
Below error will be returned.
{"statusCode":400,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"Error parsing xhtml: Unexpected close tag </span>; expected </img>.\n at [row,col {unknown-source}]: [1,1084]","reason":"Bad Request"}%
Workaround
Adding close tag( </img> ) into data.json