aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanagaraj Manickam <kanagaraj.manickam@huawei.com>2020-09-25 19:50:28 +0530
committerKanagaraj Manickam <kanagaraj.manickam@huawei.com>2020-10-19 22:19:56 +0530
commitf4372970fdb57b851ce52d6ca15e027f88558809 (patch)
tree474f306e0a8f071cbf527357a23708764cc84969
parentce47ddba11aaad9c73f53ce89758a3bfb5f2b29e (diff)
Added upload file validation
Issue-ID: DOVETAIL-801 Signed-off-by: Kanagaraj Manickam <kanagaraj.manickam@huawei.com> Change-Id: I2e0b2d874934423719ee94cefac45d20d5f798b1
-rw-r--r--opnfv_testapi/resources/result_handlers.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/opnfv_testapi/resources/result_handlers.py b/opnfv_testapi/resources/result_handlers.py
index bb1b488..ad0b37c 100644
--- a/opnfv_testapi/resources/result_handlers.py
+++ b/opnfv_testapi/resources/result_handlers.py
@@ -403,6 +403,10 @@ class ResultsFileUploadHandler(ResultsCLHandler):
if not input_token or not input_token == token:
raises.Unauthorized(message.invalid_token())
file_array = self.request.files.get('file', None)
+ if file_array is None:
+ msg = 'Please upload a file.'
+ self.finish_request({'code': 403, 'msg': msg})
+ return
fileinfo = file_array[0]
try:
tar_in = tarfile.open(fileobj=io.BytesIO(fileinfo['body']),