From 9c7bf6c8b546c04eb198a3a09bf3f98f693d6285 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 13 Jul 2022 10:27:47 -0400 Subject: [PATCH] Island: Use HTTPStatus Enum in PBA FileUpload resource --- monkey/monkey_island/cc/resources/pba_file_upload.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monkey/monkey_island/cc/resources/pba_file_upload.py b/monkey/monkey_island/cc/resources/pba_file_upload.py index eee10a3d9..61de8e1ec 100644 --- a/monkey/monkey_island/cc/resources/pba_file_upload.py +++ b/monkey/monkey_island/cc/resources/pba_file_upload.py @@ -70,7 +70,7 @@ class FileUpload(AbstractResource): return send_file(file, mimetype="application/octet-stream") except repository.FileNotFoundError as err: logger.error(str(err)) - return make_response({"error": str(err)}, 404) + return make_response({"error": str(err)}, HTTPStatus.NOT_FOUND) # NOTE: Consider putting most of this functionality into a service when this is transformed into # a payload plugin. @@ -96,7 +96,7 @@ class FileUpload(AbstractResource): raise err # API Spec: HTTP status code should be 201 - response = Response(response=safe_filename, status=200, mimetype="text/plain") + response = Response(response=safe_filename, status=HTTPStatus.OK, mimetype="text/plain") return response def _update_config(self, target_os: str, safe_filename: str): @@ -136,7 +136,7 @@ class FileUpload(AbstractResource): raise err # API Spec: HTTP status code should be 204 - return make_response({}, 200) + return make_response({}, HTTPStatus.OK) @staticmethod def _is_target_os_supported(target_os: str) -> bool: