Details
-
Bug
-
Resolution: Fixed
-
Low
-
Severity 3 - Minor
-
Description
Issue Summary
Sending a request to the PUT /wiki/rest/api/content/{id} REST API endpoint in order to update a page fails returning below error message if no value is present/provided for the user-agent header:
"Content body cannot be converted to new editor format" error when updating page content
However:
- According to RFC 7231 the user agent is not mandatory (it says it should, not must):
A user agent SHOULD send a User-Agent field in each request unless specifically configured not to do so. - The error message returned is misleading and does not help understand what the problem is (it should mention: no user agent or something similar)
Steps to Reproduce
- Update a page content sending a PUT request to the /wiki/rest/api/content/{id} endpoint without providing any user-agent header.
Expected Results
The page gets updated, or you get an error message saying that you must provide a value for the user-agent in order to be able to update content
Actual Results
You get status code 400 (bad request), that is correct, but the returned error message is totally misleading:
"Content body cannot be converted to new editor format" error when updating page content
The below exception is found in the logs:
2020-03-27 13:37:06.521 ERROR com.atlassian.confluence.content.render.xhtml.DefaultRenderer Error rendering content for view: RuntimeException occurred while performing an XHTML storage transformation (null) com.atlassian.confluence.content.render.xhtml.XhtmlException: RuntimeException occurred while performing an XHTML storage transformation (null) com.atlassian.confluence.content.render.xhtml.atlassiandocformat.StorageXhtmltoADFTransformer.transform(StorageXhtmltoADFTransformer.java:115) com.atlassian.confluence.content.render.xhtml.DefaultRenderer.renderWithoutMetrics(DefaultRenderer.java:188) com.atlassian.confluence.content.render.xhtml.DefaultRenderer.renderWithResult(DefaultRenderer.java:145) com.atlassian.confluence.content.render.xhtml.DefaultFormatConverter.convertToAtlasDocFormatWithResult(DefaultFormatConverter.java:174) com.atlassian.confluence.api.impl.service.content.ContentBodyConversionManagerImpl.computeConvertedValue(ContentBodyConversionManagerImpl.java:400) [.....] org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException: java.util.regex.Matcher.getTextLength(Matcher.java:1283) java.util.regex.Matcher.reset(Matcher.java:309) java.util.regex.Matcher.<init>(Matcher.java:229) java.util.regex.Pattern.matcher(Pattern.java:1093) com.atlassian.confluence.mobile.MobileUtils.getIosAppVersion(MobileUtils.java:33) [...] ... 367 more 2020-03-27 13:37:06.521 WARN com.atlassian.confluence.api.impl.service.content.ContentBodyConversionManagerImpl Could not convert storage format to atlas_doc_format format using ceo with id : -1
Workaround
None, you must provide a value for the user agent.