Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Newline character in HTML causes `UnsupportedOperationException` when updating a page Edited

Steps to reproduce - 

def update_with_attachment(page,  space, version):
    data = {
        "type": "page",
        "title": title,
        "id": page,
        "space": {"key": space},
        "body": {
           "storage": {
             "value": '<ac:image><ri:attachment ri:filename="image.png">\n</ri:attachment></ac:image>',
             "representation": "storage"
           }
        },
        "version": {"number": version}
}
response = requests.put(url, json=data, auth=auth)

 

Expected result - 

A 200 Response

 

Actual result - 

com.atlassian.confluence.api.service.exceptions.InternalServerException: java.lang.RuntimeException: com.atlassian.confluence.content.render.xhtml.storage.resource.identifiers.StorageUnmarshalXhtmlException: java.lang.UnsupportedOperationException

 

Workaround:

Remove the newline character from 

<ri:attachment ri:filename="image.png">\n</ri:attachment>

 

1 answer

0 votes
Diego Atlassian Team Mar 18, 2021

Hello there @Andrew Marshall!

As I understand, you need to create a new line after the attachment you created. I also believe that you are trying to do so via REST, is that correct?

The way you added the newline character shows us that the \n was added as if it was inside the attachment structure, not after it.

You can try adding the \n after the attachment structure. You can check more details about REST API here:

Confluence Cloud Developer - Content - attachments

Let us hear from you!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Confluence Cloud

Introducing Confluence Cloud for Microsoft Teams (Available for Preview!)

Hi Atlassian Community, Remote work has shifted how teams collaborate, and we’ve heard from many of you that Microsoft Teams has become mission critical to many of your workflows, from how you chat...

2,408 views 16 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you