Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
7.3
-
None
-
Unknown
-
Description
Steps to reproduce:
- Create a (non-hidden) page
- Execute the following JavaScript snippet in the browser's console:
fetch(require('xwiki-meta').restURL, { method: 'PUT', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify({ hidden: true }) }) .then(response => response.json()) .then(json => { console.log('Response:', json); }) .catch(error => { console.error('Error sending PUT request:', error); });
Expected result:
The page is now hidden and the updated page is logged.
Actual result:
The page hasn't been updated and an error "Error sending PUT request: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data" is logged because the response is empty (status 304 not modified). This is very related to XWIKI-22336 as while the code always applies the hidden property, it never marks the document as modified after changing it.
As a workaround, any property like the title can be specified with the same value as returned by the REST API, then the document is correctly updated.