Closed DavidBuchanan314 closed 3 years ago
Oops, I should have checked for linter warnings first
Thank you for the fix! Is there a reason why you check for == 0
? I don't think that brings any useful information. Returning Unsupported
on empty files sounds fine to me.
Oops, that was actually a mistake, I left that in after pondering an if
statement, then changed my mind.
Fixes #77
For files shorter than 20 bytes, the remaining bytes in the buffer will stay zeroes. The format detection logic seems to be fine with this.
One side-effect of this change is that attempting to open a zero-length file will now error with:
Instead of the original behavior:
IMHO this is fine, although a check could be added to make sure that a non-zero number of bytes were read.