replace_file() leaves stale checksum
tparker-usgs opened this issue · 1 comments
tparker-usgs commented
When SbSession.replace_file() updates an item, it leaves the checksum for the old file in place. It would be better for replace_file() to set the checksum to None.
The process I've used to replace a file, verify it was received correctly, and update the checksum in the item is:
- upload the new file and receive the temporary path back
- update ScienceBase item to reference the temporary path of the new file and set the checksum to None
- download the item JSON and receive the permanent path of the new file
- download the new file and compare the checksum of the received file to what was uploaded
- update the ScienceBase item with the correct checksum
I've implemented that workflow here:
https://code.chs.usgs.gov/tparker/sb-dynamic-data-update/-/blob/main/sb_update/filereplacer.py
ennsk commented
@tparker-usgs This has been fixed with the new version 2.0.5