Skip to content

Commit

Permalink
Trim OTA checksum for whitespace before comparing (#819)
Browse files Browse the repository at this point in the history
  • Loading branch information
agners authored Jul 19, 2024
1 parent 69bc4cb commit e545921
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions matter_server/server/ota/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,12 @@ async def download_update(self, update_desc: dict) -> None:
# Download finished, check checksum if necessary
if checksum_alg:
checksum = b64encode(checksum_alg.digest()).decode("ascii")
if checksum != update_desc["otaChecksum"]:
checksum_expected = update_desc["otaChecksum"].strip()
if checksum != checksum_expected:
LOGGER.error(
"Checksum mismatch for file '%s', expected: %s, got: %s",
"Checksum mismatch for file '%s', expected: '%s', got: '%s'",
file_name,
update_desc["otaChecksum"],
checksum_expected,
checksum,
)
await loop.run_in_executor(None, file_path.unlink)
Expand Down

0 comments on commit e545921

Please sign in to comment.