Skip to content

Commit 7f0399e

Browse files
author
Christian Geie
committed
add check for 'none' response
in _get_file_data_and_name() to avoid AttributeError
1 parent d1dc57c commit 7f0399e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/resources.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ def _get_file_data_and_name(full_filename, content, enable_5xx, content_type=CON
7979
filename = full_filename[:-4]
8080
if content_type == CONTENT_TYPE_BASE64_BINARY:
8181
file_url = file_data.decode('utf8')
82-
file_data = request(file_url, "GET", enable_5xx).content
82+
response = request(file_url, "GET", enable_5xx)
83+
file_data = response.content if response else b""
8384
else:
84-
file_data = request(file_data, "GET", enable_5xx).text
85+
response = request(file_data, "GET", enable_5xx)
86+
file_data = response.text if response else ""
8587
else:
8688
filename = full_filename
8789

0 commit comments

Comments
 (0)