Merge branch 'gabr/fixsha' into 'master'

DownloadWorker, really fail on incorrect hashes

See merge request AuroraOSS/AuroraStore!354
This commit is contained in:
Aayush Gupta
2024-07-27 13:52:28 +00:00

View File

@@ -298,8 +298,13 @@ class DownloadWorker @AssistedInject constructor(
}
// Ensure downloaded file matches expected sha
assert(validSha(request.file, expectedSha, algorithm))
return@withContext Result.success()
if (validSha(request.file, expectedSha, algorithm)) {
return@withContext Result.success()
} else {
Log.e(TAG, "Incorrect hash for ${request.file}")
throw Exception("Incorrect hash")
}
} catch (exception: Exception) {
Log.e(TAG, "Failed to download ${request.file}!", exception)
notifyStatus(DownloadStatus.FAILED)