summaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/importers/matched.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-23 21:08:36 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-23 21:08:36 -0800
commitad9cd8a98aa5dce24d49b5a9c460a653f5e840a3 (patch)
tree54ea1dde0f831265550dbe66a7ccc867a83b80ce /python/fatcat_tools/importers/matched.py
parent4fd244c2b1dd393d5b26607f99777a678a78c781 (diff)
downloadfatcat-ad9cd8a98aa5dce24d49b5a9c460a653f5e840a3.tar.gz
fatcat-ad9cd8a98aa5dce24d49b5a9c460a653f5e840a3.zip
importer bugfixes
Diffstat (limited to 'python/fatcat_tools/importers/matched.py')
-rw-r--r--python/fatcat_tools/importers/matched.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/fatcat_tools/importers/matched.py b/python/fatcat_tools/importers/matched.py
index 123e3530..2ec6c95d 100644
--- a/python/fatcat_tools/importers/matched.py
+++ b/python/fatcat_tools/importers/matched.py
@@ -120,6 +120,9 @@ class MatchedImporter(EntityImporter):
if err.status != 404:
raise err
+ if not existing:
+ return True
+
fe.release_ids = list(set(fe.release_ids + existing.release_ids))
if set(fe.release_ids) == set(existing.release_ids) and len(existing.urls) > 0:
# no new release matches *and* there are already existing URLs
@@ -127,13 +130,14 @@ class MatchedImporter(EntityImporter):
return False
# merge the existing into this one and update
- existing.urls = list(set(fe.urls + existing.urls))
+ existing.urls = list(set([(u.rel, u.url) for u in fe.urls + existing.urls]))
+ existing.urls = [fatcat_client.FileEntityUrls(rel=rel, url=url) for (rel, url) in existing.urls]
existing.release_ids = list(set(fe.release_ids + existing.release_ids))
existing.mimetype = existing.mimetype or fe.mimetype
existing.size = existing.size or fe.size
existing.md5 = existing.md5 or fe.md5
existing.sha256 = existing.sha256 or fe.sha256
- self.api.update_file(existing.ident, existing)
+ self.api.update_file(existing.ident, existing, editgroup_id=self._get_editgroup())
self.counts['update'] += 1
return False