提交 e3e21bb1 编写于 作者: U unknown

fixed in reports/advancedreportfile.py

上级 7634bff3
...@@ -104,18 +104,15 @@ class AdvancedReportFileCollection: ...@@ -104,18 +104,15 @@ class AdvancedReportFileCollection:
if rows is not None and len(rows) > 0: if rows is not None and len(rows) > 0:
for row in rows: for row in rows:
# Base64 encode the bytes # Base64 encode the bytes
base64_encoded_data = base64.b64encode(row[5])
# get the Base64 encoded data using human-readable characters. # get the Base64 encoded data using human-readable characters.
base64_message = base64_encoded_data.decode('utf-8')
create_datetime_local = row[3].replace(tzinfo=None) + \
timedelta(minutes=timezone_offset)
meta_result = {"id": row[0], meta_result = {"id": row[0],
"file_name": row[1], "file_name": row[1],
"uuid": row[2], "uuid": row[2],
"create_datetime_local": create_datetime_local.isoformat(), "create_datetime_local": (row[3].replace(tzinfo=None) +
timedelta(minutes=timezone_offset)).isoformat(),
"file_type": row[4], "file_type": row[4],
"file_size_bytes": sys.getsizeof(row[5]), "file_size_bytes": sys.getsizeof(row[5]),
"file_bytes_base64": base64_message} "file_bytes_base64": (base64.b64encode(row[5])).decode('utf-8')}
result.append(meta_result) result.append(meta_result)
resp.text = json.dumps(result) resp.text = json.dumps(result)
...@@ -163,16 +160,14 @@ class AdvancedReportFileItem: ...@@ -163,16 +160,14 @@ class AdvancedReportFileItem:
description='API.ADVANCED_REPORT_NOT_FOUND') description='API.ADVANCED_REPORT_NOT_FOUND')
# Base64 encode the bytes # Base64 encode the bytes
base64_encoded_data = base64.b64encode(row[5])
# get the Base64 encoded data using human-readable characters. # get the Base64 encoded data using human-readable characters.
base64_message = base64_encoded_data.decode('utf-8')
result = {"id": row[0], result = {"id": row[0],
"file_name": row[1], "file_name": row[1],
"uuid": row[2], "uuid": row[2],
"create_datetime": row[3].replace(tzinfo=timezone.utc).timestamp() * 1000, "create_datetime": row[3].replace(tzinfo=timezone.utc).timestamp() * 1000,
"file_type": row[4], "file_type": row[4],
"file_bytes_base64": base64_message} "file_bytes_base64": (base64.b64encode(row[5])).decode('utf-8')}
resp.text = json.dumps(result) resp.text = json.dumps(result)
@staticmethod @staticmethod
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册