Skip to content
Snippets Groups Projects
Commit 04d3e5d9 authored by Daniel Neuwirth's avatar Daniel Neuwirth
Browse files

c

parent c5cc597b
No related tags found
No related merge requests found
...@@ -86,6 +86,10 @@ def create_thumbnail_from_url(resource, private): ...@@ -86,6 +86,10 @@ def create_thumbnail_from_url(resource, private):
#log.debug(response) #log.debug(response)
if response: if response:
body = response.read() body = response.read()
encoding = response.info().getencoding()
encoded_body = body.decode(encoding)
log.debug('encoded_body mime: {}'.format(magic.from_buffer(encoded_body, mime = True)))
body_decoded = body.decode('utf-8') body_decoded = body.decode('utf-8')
log.debug('body_decoded mime: {}'.format(magic.from_buffer(body_decoded, mime = True))) log.debug('body_decoded mime: {}'.format(magic.from_buffer(body_decoded, mime = True)))
body_encoded = body.body_encoded('utf-8') body_encoded = body.body_encoded('utf-8')
...@@ -94,6 +98,13 @@ def create_thumbnail_from_url(resource, private): ...@@ -94,6 +98,13 @@ def create_thumbnail_from_url(resource, private):
memory_file = io.BytesIO(response.read()) memory_file = io.BytesIO(response.read())
log.debug('memory_file mime: {}'.format(magic.from_buffer(memory_file.read(), mime = True))) 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'
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 is not None')
log.debug('response: {}'.format(response.read())) log.debug('response: {}'.format(response.read()))
temp_path = config.get('ckan.storage_path') + '/resources/' + 'temp_for_thumbnail' temp_path = config.get('ckan.storage_path') + '/resources/' + 'temp_for_thumbnail'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment