diff --git a/ckanext/odsh/pdf_to_thumbnail/thumbnail.py b/ckanext/odsh/pdf_to_thumbnail/thumbnail.py index d3a8c52ce9396fa73c333b7ebc7affc5bb79b1e5..1a00f23dcadb687da98d040a200daa4706b7ae26 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())