Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions figshare/Article.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,8 @@ def __download_files(self, files, version_data, folder_name):

folder_for_file = ''
# if an item version has no folders, folders dict will be empty
if len(version_data['folder_structure'].keys()) > 0 and str(file['id']) in version_data['folder_structure'].keys():
if 'folder_structure' in version_data.keys() and len(version_data['folder_structure'].keys()) > 0 and \
str(file['id']) in version_data['folder_structure'].keys():
folder_for_file = version_data['folder_structure'][str(file['id'])]
filepath = os.path.join(article_folder_path, folder_for_file)
if not os.path.exists(filepath):
Expand Down Expand Up @@ -760,7 +761,8 @@ def __check_file_hash(self, files, version_data, folder_path):
self.logs.write_log_in_file('info', "Comparing Figshare file hashes against existing local files.", True)
for file in files:
# if an item version has no folders, folders dict will be empty
if len(version_data['folder_structure'].keys()) > 0 and str(file['id']) in version_data['folder_structure'].keys():
if 'folder_structure' in version_data.keys() and len(version_data['folder_structure'].keys()) > 0 and \
str(file['id']) in version_data['folder_structure'].keys():
folder_for_file = version_data['folder_structure'][str(file['id'])]
else:
folder_for_file = ''
Expand Down
Loading