Error Fixed

pull/586/head
TonyJabbour 2021-10-04 15:25:14 +02:00
parent c2bf5aebdf
commit 7669373002
2 changed files with 4 additions and 5 deletions

View File

@ -1,6 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*-coding:UTF-8 -* # -*-coding:UTF-8 -*
import base64
import os import os
import re import re
import sys import sys
@ -235,9 +234,9 @@ def get_item_as_txt(request_dict):
return {'status': 'error', 'reason': 'Item not found'}, 404 return {'status': 'error', 'reason': 'Item not found'}, 404
item_content = get_item_content(item_id) item_content = get_item_content(item_id)
encoded_item_content = item_content.encode("UTF-8") #encoded_item_content = item_content.encode("UTF-8")
base64_output = base64.b64encode(encoded_item_content) #base64_output = base64.b64encode(encoded_item_content)
dict_item = {'id': item_id, 'content': base64_output} dict_item = {'id': item_id, 'content': item_content}
return dict_item, 200 return dict_item, 200

View File

@ -321,7 +321,7 @@ def get_item_content():
item_id = data.get('id', None) item_id = data.get('id', None)
req_data = {'id': item_id} req_data = {'id': item_id}
res = Item.get_item_as_txt(req_data) res = Item.get_item_as_txt(req_data)
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='text/plain'), res[1] return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #