Merge pull request #2452 from stuaxo/patch-6

Importer: Avoid downloading duplicate post attachments
This commit is contained in:
Justin Mayer 2018-11-26 08:12:54 -08:00 committed by GitHub
commit 3596e04639
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

View file

@ -699,7 +699,7 @@ def get_attachments(xml):
else:
filename = get_filename(post_name, post_id)
names[post_id] = filename
attachedposts = defaultdict(list)
attachedposts = defaultdict(set)
for parent, url in attachments:
try:
parent_name = names[parent]
@ -707,7 +707,7 @@ def get_attachments(xml):
# attachment's parent is not a valid post
parent_name = None
attachedposts[parent_name].append(url)
attachedposts[parent_name].add(url)
return attachedposts