Merge pull request #380 from JakubOnderka/patch-1

csvimport: Return error if input is not valid UTF-8
pull/388/head
Christian Studer 2020-03-18 10:11:26 +01:00 committed by GitHub
commit b869c416d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -256,7 +256,11 @@ def handler(q=False):
return False
request = json.loads(q)
if request.get('data'):
try:
data = base64.b64decode(request['data']).decode('utf-8')
except UnicodeDecodeError:
misperrors['error'] = "Input is not valid UTF-8"
return misperrors
else:
misperrors['error'] = "Unsupported attributes type"
return misperrors