mirror of https://github.com/MISP/misp-modules
Merge pull request #380 from JakubOnderka/patch-1
csvimport: Return error if input is not valid UTF-8pull/388/head
commit
b869c416d8
|
@ -256,7 +256,11 @@ def handler(q=False):
|
||||||
return False
|
return False
|
||||||
request = json.loads(q)
|
request = json.loads(q)
|
||||||
if request.get('data'):
|
if request.get('data'):
|
||||||
data = base64.b64decode(request['data']).decode('utf-8')
|
try:
|
||||||
|
data = base64.b64decode(request['data']).decode('utf-8')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
misperrors['error'] = "Input is not valid UTF-8"
|
||||||
|
return misperrors
|
||||||
else:
|
else:
|
||||||
misperrors['error'] = "Unsupported attributes type"
|
misperrors['error'] = "Unsupported attributes type"
|
||||||
return misperrors
|
return misperrors
|
||||||
|
|
Loading…
Reference in New Issue