By comparing the hash we can avoid always deleting and re-uploading files when syncing or verifying challenges.
Also did some housekeeping:
load_installed_challenge should throw an exception when it fails to load the challenge. This has been always assumed and there are checks before that call, but there's just no reason for it to return None instead of throwing.
Moved helper functions to be before the public functions, as they were all over the place.
These changes should be backward compatible, sha1sum has been treated completely optionally, and we'll still use the old behavior if it's not present.
Use changes in CTFd 3.7+ (sha1sum for files) to determine whether files should be re-uploaded.
https://github.com/CTFd/CTFd/pull/2451
By comparing the hash we can avoid always deleting and re-uploading files when syncing or verifying challenges.
Also did some housekeeping:
load_installed_challenge
should throw an exception when it fails to load the challenge. This has been always assumed and there are checks before that call, but there's just no reason for it to return None instead of throwing.These changes should be backward compatible, sha1sum has been treated completely optionally, and we'll still use the old behavior if it's not present.