Skip to content

Commit 45dc733

Browse files
authored
fix: Set a default timestamp of year 2000 (google#3496)
Apparently zips can't handle years before 1980, and unix epoch time is 1970
1 parent 4516d4c commit 45dc733

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

gcp/workers/exporter/export_runner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ def spawn_ecosystem_exporter(work_dir: str, bucket: str, eco: str):
7979
])
8080
return_code = proc.wait()
8181
if return_code != 0:
82-
logging.error('Export of %s failed with Exit Code: %d', eco, return_code)
82+
logging.error(
83+
'Export of %s failed with Exit Code: %d. See logs for related errors.',
84+
eco, return_code)
8385

8486

8587
def aggregate_all_vulnerabilities(work_dir: str, export_bucket: str):

osv/sources.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
YAML_EXTENSIONS = ('.yaml', '.yml')
3838
JSON_EXTENSIONS = ('.json',)
3939

40+
DEFAULT_TIMESTAMP = 946684800 # Year 2000
41+
4042
shared_cache = cache.InMemoryCache()
4143

4244

@@ -249,6 +251,7 @@ def write_vulnerability(vulnerability: vulnerability_pb2.Vulnerability,
249251
dt_timestamp = vulnerability.modified.seconds
250252
if dt_timestamp == 0:
251253
logging.warning('Record has no modified time: %s', vulnerability.id)
254+
dt_timestamp = DEFAULT_TIMESTAMP
252255

253256
_write_vulnerability_dict(data, output_path, dt_timestamp)
254257

0 commit comments

Comments
 (0)