Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
_TEST_FILE_SIZE not 10 KiB #3846
Comments
|
Test file size is indeed 10241 bytes and this is probably due to historical reasons. As you noticed, changing the |
In test mode, only the first 10 KiB of a file are said to be downloaded and its MD5 hash compared to the value specified in the test case.
While writing a new extractor, I naturally tried to compute the hash as follows:
Which only gave a hash that wouldn’t match…
Looking up the definition of the
_TEST_FILE_SIZEand the use of it in an HTTP Range request revealed that it isn’t 10 KiB (10240 B) that is downloaded but actually 10241 B sinceRange: bytes=0-10240requests the bytes from 0 to 10240, inclusively:I have no idea what’s the best way to fix this. Changing the definition of
_TEST_FILE_SIZEwould render probably almost every test case invalid. Updating the respective line in the template may be sufficient.But maybe the hash is not even meant to be computed the way I tried. Maybe you just enter an arbitrary string for the hash and let the test fail and use the expected string instead…