From 7fb796172c714222b0f1c083825a5bcc5ef4078d Mon Sep 17 00:00:00 2001 From: TonyJabbour Date: Mon, 4 Oct 2021 15:54:57 +0200 Subject: [PATCH] Base64 Problem --- bin/packages/Item.py | 25 +----------------------- var/www/modules/restApi/Flask_restApi.py | 2 -- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/bin/packages/Item.py b/bin/packages/Item.py index e62688d0..cfe4c37b 100755 --- a/bin/packages/Item.py +++ b/bin/packages/Item.py @@ -222,9 +222,6 @@ def get_item(request_dict): - - -# API as txt def get_item_as_txt(request_dict): item_id = request_dict.get('id', None) @@ -236,32 +233,12 @@ def get_item_as_txt(request_dict): return {'status': 'error', 'reason': 'Item not found'}, 404 item_content = get_item_content(item_id) - base64_output = base64.b64encode(item_content.encode()) + base64_output = base64.b64encode((item_content.encode('utf-8')).decode()) dict_item = {'id': item_id, 'content': base64_output} return dict_item, 200 - - - - - - - - - - - - - - - - - - - - ### ### correlation diff --git a/var/www/modules/restApi/Flask_restApi.py b/var/www/modules/restApi/Flask_restApi.py index 6ba69f63..7901f5e9 100644 --- a/var/www/modules/restApi/Flask_restApi.py +++ b/var/www/modules/restApi/Flask_restApi.py @@ -305,7 +305,6 @@ def delete_item_tags(): @restApi.route("api/v1/get/item/content", methods=['POST']) @token_required('read_only') def get_item_content(): - data = request.get_json() item_id = data.get('id', None) req_data = {'id': item_id, 'date': False, 'content': True, 'tags': False} @@ -316,7 +315,6 @@ def get_item_content(): @restApi.route("api/v1/get/item/content/text", methods=['POST']) @token_required('read_only') def get_item_content_text(): - data = request.get_json() item_id = data.get('id', None) req_data = {'id': item_id}