Show More
@@ -6,6 +6,7 b' from boards.models import KeyPair, Globa' | |||
|
6 | 6 | from boards.models.attachment.downloaders import download |
|
7 | 7 | from boards.utils import get_file_mimetype, get_file_hash |
|
8 | 8 | from django.db import transaction |
|
9 | from django import forms | |
|
9 | 10 | |
|
10 | 11 | EXCEPTION_NODE = 'Sync node returned an error: {}.' |
|
11 | 12 | EXCEPTION_DOWNLOAD = 'File was not downloaded.' |
@@ -236,15 +237,20 b' class SyncManager:' | |||
|
236 | 237 | tag_ref = tag_refs.find("{}[@ref='{}']".format( |
|
237 | 238 | TAG_ATTACHMENT_REF, attachment.text)) |
|
238 | 239 | url = tag_ref.get(ATTR_URL) |
|
239 | attached_file = download(hostname + url) | |
|
240 |
|
|
|
241 | raise SyncException(EXCEPTION_DOWNLOAD) | |
|
240 | try: | |
|
241 | attached_file = download(hostname + url) | |
|
242 | ||
|
243 | if attached_file is None: | |
|
244 | raise SyncException(EXCEPTION_DOWNLOAD) | |
|
242 | 245 | |
|
243 | hash = get_file_hash(attached_file) | |
|
244 | if hash != attachment.text: | |
|
245 | raise SyncException(EXCEPTION_HASH) | |
|
246 | hash = get_file_hash(attached_file) | |
|
247 | if hash != attachment.text: | |
|
248 | raise SyncException(EXCEPTION_HASH) | |
|
246 | 249 | |
|
247 | files.append(attached_file) | |
|
250 | files.append(attached_file) | |
|
251 | except forms.ValidationError: | |
|
252 | urls.append(hostname+url) | |
|
253 | ||
|
248 | 254 | |
|
249 | 255 | if is_old: |
|
250 | 256 | post = global_id.post |
General Comments 0
You need to be logged in to leave comments.
Login now