Skip to content

Commit

Permalink
Auto-remove corrupt PBF and MD5 files on verification fail
Browse files Browse the repository at this point in the history
  • Loading branch information
mnm-matin committed Mar 13, 2024
1 parent 0b35cb4 commit 9144265
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions earth_osm/gfk_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def download_pbf(url, update, data_dir):
down_pbf_fp = download_file(url, pbf_dir)
down_md5_fp = download_file(url + ".md5", pbf_dir, exists_ok=not update)
if not verify_pbf(down_pbf_fp, down_md5_fp):
os.remove(down_pbf_fp)
os.remove(down_md5_fp)
raise ValueError(f"File verification failed after retry for {pbf_fn}")

return pbf_fp
Expand Down

0 comments on commit 9144265

Please sign in to comment.