Skip to content

Commit

Permalink
use 409 to interrupt larger uploads with an error
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas committed Apr 28, 2024
1 parent 8e35029 commit d2c94ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/handler/httphandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d2c94ab

Please sign in to comment.