Skip to content

Commit 9bdb33a

Browse files
authored
fix: Account for existing modified in the database for re-imports (#5045)
Current code has an issue where reimports will revert the record back to the original upstream record's modified date. Fixes #5026
1 parent d5c1d79 commit 9bdb33a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

gcp/workers/worker/worker.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,9 +695,12 @@ def xact():
695695
# Update the bug entity based on the comparison.
696696
if has_changed:
697697
ds_vuln.modified = osv.utcnow()
698-
else:
698+
elif ds_vuln.modified:
699699
# If no meaningful change, ensure last_modified reflects the source
700-
# file's modified date, as only metadata might have changed.
700+
# file's modified date or the date in the database, whichever is later.
701+
ds_vuln.modified = max(ds_vuln.modified, orig_modified_date)
702+
else:
703+
# New record, so set it to the upstream records modified date.
701704
ds_vuln.modified = orig_modified_date
702705

703706
# Overwrite aliases / upstream from computation

0 commit comments

Comments
 (0)