Fix fileGet command

This commit is contained in:
shortcutme 2019-03-29 02:31:14 +01:00
parent 3d05bdcb63
commit bddf2d6537
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 7 additions and 2 deletions

View File

@ -698,9 +698,14 @@ class UiWebsocket(object):
except Exception as err:
self.log.error("%s fileGet error: %s" % (inner_path, Debug.formatException(err)))
body = None
if body and format == "base64":
if not body:
body = None
elif format == "base64":
import base64
body = base64.b64encode(body)
body = base64.b64encode(body).decode()
else:
body = body.decode()
self.response(to, body)
def actionFileNeed(self, to, inner_path, timeout=300):