Open
Description
I believe this is a bug in how the API is processing the strings in the request body for wiki creation - but this doesn't appear when using the manual online interface.
Through the online interface, there is no issue creating a new wiki page with an ampersand. Pressing the new button and typing A & B
creates a wiki that appears as A & B
in the wiki panel and that has a link of https://osf.io/{node_id}/wiki/A%20%26%20B/
The processor that handles API requests, on the other hand, is not handling this correctly for the name
field, at least when using the native requests library with python:
- If you pass in the unescaped "A & B" in the request body, the name in the Wiki Panel appears as
A & B
; however, the formatted title appears correct when reading the page, presumably because the website is rendering the&
- If you attempt to escape it by passing in "A %26 B" or "A%20%26%20B" or "A+%26+B", these are all fully escaped and appear as listed.
Trivial example that leads to the described behavior.
import requests
resp = requests.post(
f'https://api.osf.io/v2/nodes/{node_id}/wikis/',
headers={"Authorization" : "Bearer " + access_token},
data={
'type': 'wikis',
'content': "#Heading\n\nText text text",
'name': "A & B",
})
print(resp.json())