etherpad-lite: Calling the HTTP API to create an empty pad does not create a pad
Describe the bug Calling the HTTP API method /createPad to create an empty pad does not actually create a pad.
To Reproduce Call the /createPad method with an empty text parameter. e.g. …/createPad?apikey=APIKEY&padID=PADID&text=&authorId=AUTHORID
Expected behavior An empty pad should be created when calling the method with an empty text. (or an error should be returned stating that the text parameter must not be empty)
Server (please complete the following information):
- Etherpad version: 1.9.0
- OS: Oracle Linux Server 8.8
Additional context It seems like the issue might be located in the Pad class’s appendRevision method (located in src/node/db/Pad.js).
async appendRevision(aChangeset, authorId = '') {
const newAText = Changeset.applyToAText(aChangeset, this.atext, this.pool);
if (newAText.text === this.atext.text && newAText.attribs === this.atext.attribs) {
return this.head;
}
...
As the condition of matching texts and attribs is probably always evaluated to true in case of an empty text the database entry for the pad is never created in the first place.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (14 by maintainers)
I guess I wasn’t clear enough about what I mean by “empty pad”. I actually want to create a pad that does not contain any characters.
I tried that calling the API method with the text parameter being present but empty so that the pad would be created with no acutal characters.
I just tried calling
like you did while setting the the defaultPadText parameter in the settings.json to an empty string and it resulted in the same problem. At first it might seem as if the pad was created as it’s present in the admin panel’s pad overview, but there is no corresponding database entry for that pad. This results in any subsequent API call targeting that specific padID to fail with the message “padID does not exist”.