aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/importers
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-01-31 16:31:57 -0800
committerBryan Newbold <bnewbold@robocracy.org>2020-02-13 22:24:20 -0800
commit00754db377df53af18f9c4dddacdeb2e2c559206 (patch)
tree18eebc00b34b085d5105a8df0e3ca5b03ffaceb4 /python/fatcat_tools/importers
parent87029cb13d244381f915fe66e40760477edb5675 (diff)
downloadfatcat-00754db377df53af18f9c4dddacdeb2e2c559206.tar.gz
fatcat-00754db377df53af18f9c4dddacdeb2e2c559206.zip
shadow import fixes from QA testing
Diffstat (limited to 'python/fatcat_tools/importers')
-rw-r--r--python/fatcat_tools/importers/shadow.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/fatcat_tools/importers/shadow.py b/python/fatcat_tools/importers/shadow.py
index cfe1b1cf..261cf888 100644
--- a/python/fatcat_tools/importers/shadow.py
+++ b/python/fatcat_tools/importers/shadow.py
@@ -130,6 +130,9 @@ class ShadowLibraryImporter(EntityImporter):
if not existing:
return True
+ if not existing.extra:
+ existing.extra = {}
+
if existing.extra.get('shadows') and list(fe.extra['shadows'].keys())[0] in existing.extra['shadows']:
# already imported from this shadow library; skip
self.counts['exists'] += 1
@@ -172,6 +175,9 @@ class ShadowLibraryImporter(EntityImporter):
existing.sha1 = existing.sha1 or fe.sha1
existing.sha256 = existing.sha256 or fe.sha256
edit = self.api.update_file(self.get_editgroup_id(), existing.ident, existing)
+ # add sha1 to non-entity edit row, so we can do more aggressive
+ # group-level de-dupe
+ edit.sha1 = existing.sha1
self._edits_inflight.append(edit)
self.counts['update'] += 1
return False