Added return to aborts
This commit is contained in:
parent
01d7c76cff
commit
2b825985a1
@ -26,16 +26,16 @@ class ObjectView(FlaskView):
|
|||||||
try:
|
try:
|
||||||
description = self.description_schema.loads(request.form.get('description'))
|
description = self.description_schema.loads(request.form.get('description'))
|
||||||
except ValidationError as e:
|
except ValidationError as e:
|
||||||
abort(400, str(e))
|
return abort(400, str(e))
|
||||||
|
|
||||||
# get and validate file
|
# get and validate file
|
||||||
file = request.files['soundFile']
|
file = request.files['soundFile']
|
||||||
|
|
||||||
if file.content_type != 'audio/wave':
|
if file.content_type != 'audio/wave':
|
||||||
abort(400, f"{file.content_type} is not audio/wave")
|
return abort(400, f"{file.content_type} is not audio/wave")
|
||||||
|
|
||||||
if file.content_length <= 0:
|
if file.content_length <= 0:
|
||||||
abort(411, f"Content length for soundFile is not a positive integer or missing.")
|
return abort(411, f"Content length for soundFile is not a positive integer or missing.")
|
||||||
|
|
||||||
# create bucket if necessary
|
# create bucket if necessary
|
||||||
try:
|
try:
|
||||||
@ -49,7 +49,7 @@ class ObjectView(FlaskView):
|
|||||||
|
|
||||||
# check for conflict
|
# check for conflict
|
||||||
if self._check_existance(description['tag']):
|
if self._check_existance(description['tag']):
|
||||||
abort(409)
|
return abort(409)
|
||||||
|
|
||||||
# poot file into bucket
|
# poot file into bucket
|
||||||
try:
|
try:
|
||||||
@ -67,7 +67,7 @@ class ObjectView(FlaskView):
|
|||||||
try:
|
try:
|
||||||
data = storage.connection.get_object(current_app.config['MINIO_BUCKET_NAME'], tag)
|
data = storage.connection.get_object(current_app.config['MINIO_BUCKET_NAME'], tag)
|
||||||
except NoSuchKey:
|
except NoSuchKey:
|
||||||
abort(404)
|
return abort(404)
|
||||||
|
|
||||||
return Response(data.stream(), mimetype=data.headers['Content-type'])
|
return Response(data.stream(), mimetype=data.headers['Content-type'])
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ class ObjectView(FlaskView):
|
|||||||
# TODO: Validate tag
|
# TODO: Validate tag
|
||||||
|
|
||||||
if not self._check_existance(tag):
|
if not self._check_existance(tag):
|
||||||
abort(404)
|
return abort(404)
|
||||||
|
|
||||||
storage.connection.remove_object(current_app.config['MINIO_BUCKET_NAME'], tag)
|
storage.connection.remove_object(current_app.config['MINIO_BUCKET_NAME'], tag)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user