Skip to content
Open
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
10 changes: 5 additions & 5 deletions CanvasSync/entities/assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ def add_files(self):
assignment to the list of children and sync
"""
# Get file URLs pointing to Canvas items
description = self.assignment_info.get(u"description", "")
try:
canvas_file_urls = re.findall(r'data-api-endpoint=\"(.*?)\"',
self.assignment_info.get(u"description") or u"")
except:
canvas_file_urls = re.findall(r'data-api-endpoint=\"(.*?)\"', description)
except Exception as e:
print("Error:", e)
canvas_file_urls = []

# Download information on all found files and add File objects
Expand All @@ -119,8 +120,7 @@ def add_files(self):
# they are not matched by this regex
# 2) We should stay clear of all links to web-sites
# (they could be large to download, we skip them here)
urls = re.findall(r'href=\"([^ ]*[.]{1}.{1,10})\"',
self.assignment_info.get(u"description") or u"")
urls = re.findall(r'href=\"([^ ]*[.]{1}.{1,10})\"', description)

for url in urls:
linked_file = LinkedFile(url, parent=self)
Expand Down