Allow extended encoding in API

This commit is contained in:
Peter Šurda 2017-04-30 10:39:48 +02:00
parent 96d58f3c11
commit bf76c7f6ec
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -650,8 +650,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
TTL = 4*24*60*60 TTL = 4*24*60*60
elif len(params) == 6: elif len(params) == 6:
toAddress, fromAddress, subject, message, encodingType, TTL = params toAddress, fromAddress, subject, message, encodingType, TTL = params
if encodingType != 2: if encodingType not in [2, 3]:
raise APIError(6, 'The encoding type must be 2 because that is the only one this program currently supports.') raise APIError(6, 'The encoding type must be 2 or 3.')
subject = self._decode(subject, "base64") subject = self._decode(subject, "base64")
message = self._decode(message, "base64") message = self._decode(message, "base64")
if len(subject + message) > (2 ** 18 - 500): if len(subject + message) > (2 ** 18 - 500):