diff options
| author | Paweł Jastrzębski <[email protected]> | 2015-09-06 18:26:15 +0200 |
|---|---|---|
| committer | Paweł Jastrzębski <[email protected]> | 2015-09-06 18:26:15 +0200 |
| commit | c6179b0064ee535bb8070df65241ddbac3325423 (patch) | |
| tree | 61fd4bf55398b6c50081c7472c1da9ec430e8135 | |
| parent | CLI: Additional source path cleanup (close #152) (diff) | |
| download | kcc-c6179b0064ee535bb8070df65241ddbac3325423.tar.gz kcc-c6179b0064ee535bb8070df65241ddbac3325423.tar.bz2 kcc-c6179b0064ee535bb8070df65241ddbac3325423.zip | |
Tweaked CBZ detection
| -rw-r--r-- | kcc/rarfile.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/kcc/rarfile.py b/kcc/rarfile.py index 567f5ce..afb19a7 100644 --- a/kcc/rarfile.py +++ b/kcc/rarfile.py @@ -360,9 +360,8 @@ class RarCannotExec(RarExecError): def is_rarfile(xfile): '''Check quickly whether file is rar archive.''' - fd = XFile(xfile) - buf = fd.read(len(RAR_ID)) - fd.close() + with open(xfile, 'rb') as fh: + buf = fh.read(len(RAR_ID)) if buf == RAR_ID or buf == RAR5_ID: return True else: |