Org-roam-protocol not appending body

I am using org-roam-protocol with mac Catalina along with roam-ref protocol . I have a bookmarklet with the following code

javascript:location.href =
    'org-protocol://roam-ref?template=r&ref='
    + encodeURIComponent(location.href)
    + '&title='
    + encodeURIComponent(document.title)
    + '&body='
    + encodeURIComponent(window.getSelection())

When i click the bookmark everything works as expected other than body part . The selected text is not being displayed . If i change the code to

javascript:location.href =
    'org-protocol://roam-ref?template=r&ref='
    + encodeURIComponent(location.href)
    + '&title='
    + encodeURIComponent(window.getSelection())

The title becomes the selected text . ie; window.getSelection is working but body part is not working . Do anybody have any idea on what is going on and what have i done wrong ?

I suggest you edebug the function org-roam-protocol-open-ref – I don’t use org-roam-protocol but it appears the body is expected in the code. You should be able to track down what’s happening with the text in the body parameter coming from the browser.