is_tarfile() returns True for a blank file
- by Zachary Young
Hello all,
I am testing some logic to handle a user uploading a TAR file. When I feed a blank file to tarfile.is_tarfile() it returns True, which is not what I am expecting:
$ touch tartest
$ cat tartest
$ python -c "import tarfile; print tarfile.is_tarfile('tartest')"
True
If I add some text to the file, it returns False, which I am…