From c5cc597b15b811816228cd215e659948129bb9ea Mon Sep 17 00:00:00 2001 From: Daniel Neuwirth <daniel.neuwirth@dataport.de> Date: Fri, 6 Dec 2019 07:29:57 +0000 Subject: [PATCH] d --- ckanext/odsh/pdf_to_thumbnail/thumbnail.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ckanext/odsh/pdf_to_thumbnail/thumbnail.py b/ckanext/odsh/pdf_to_thumbnail/thumbnail.py index d3a8c52c..1a00f23d 100644 --- a/ckanext/odsh/pdf_to_thumbnail/thumbnail.py +++ b/ckanext/odsh/pdf_to_thumbnail/thumbnail.py @@ -88,12 +88,15 @@ def create_thumbnail_from_url(resource, private): body = response.read() body_decoded = body.decode('utf-8') log.debug('body_decoded mime: {}'.format(magic.from_buffer(body_decoded, mime = True))) + body_encoded = body.body_encoded('utf-8') + + log.debug('body_encoded mime: {}'.format(magic.from_buffer(body_decoded, mime = True))) memory_file = io.BytesIO(response.read()) log.debug('memory_file mime: {}'.format(magic.from_buffer(memory_file.read(), mime = True))) log.debug('response is not None') log.debug('response: {}'.format(response.read())) - temp_path = config.get('ckan.storage_path') + '/resources/' + 'temp_for_thumbnail.pdf' + temp_path = config.get('ckan.storage_path') + '/resources/' + 'temp_for_thumbnail' with open(temp_path, 'w + b') as temp_file: temp_file.write(response.read()) -- GitLab