From d2c94ab242718af3bdd89290e11138936b193c09 Mon Sep 17 00:00:00 2001 From: andreas Date: Sun, 28 Apr 2024 20:44:14 +0200 Subject: [PATCH] use 409 to interrupt larger uploads with an error --- server/handler/httphandler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/handler/httphandler.py b/server/handler/httphandler.py index 1909d5480..4b82bab87 100644 --- a/server/handler/httphandler.py +++ b/server/handler/httphandler.py @@ -615,11 +615,15 @@ def handleUploadRequest(self,requestParam): if handler is not None: AVNLog.debug("found handler for upload request %s:%s"%(type,handler.getConfigName())) rt=handler.handleApiRequest("upload",type,requestParam,rfile=self.rfile,flen=rlen,handler=self) + if rt.get('status') != 'OK': + raise Exception(rt.get('status') or 'no status') return json.dumps(rt,cls=Encoder) else: raise Exception("invalid request %s",type) except Exception as e: - return json.dumps({'status':str(e)},cls=Encoder) + self.send_response(409,str(e)) + self.end_headers() + return None def handleListDir(self,requestParam):