mirror of
https://github.com/SunRed/haste-server.git
synced 2024-12-27 06:30:11 +01:00
Patched POST API bug
It is no longer possible to make a POST request with no body content and make a "ghost key" - which upon requesting returns 404, but it considered as a taken key
This commit is contained in:
parent
7de68695fe
commit
04e1f09fed
1 changed files with 6 additions and 0 deletions
|
@ -80,6 +80,12 @@ DocumentHandler.prototype.handlePost = function (req, res){
|
|||
|
||||
let onSuccess = async function (){
|
||||
//check length
|
||||
if (!buffer.length){
|
||||
cancelled = true;
|
||||
winston.warn('document with no length was POSTed');
|
||||
res.status(411).json({ message: 'Length required.' });
|
||||
return;
|
||||
}
|
||||
if (_this.maxLength && buffer.length > _this.maxLength){
|
||||
cancelled = true;
|
||||
winston.warn('document >maxLength', { maxLength: _this.maxLength });
|
||||
|
|
Loading…
Reference in a new issue