Assume empty files are unencrypted.
This commit is contained in:
parent
719367facb
commit
9686695170
1 changed files with 5 additions and 1 deletions
|
@ -51,7 +51,11 @@ def is_encrypted(filename):
|
||||||
|
|
||||||
# read first line of the file
|
# read first line of the file
|
||||||
with open(filename) as f:
|
with open(filename) as f:
|
||||||
head = f.next()
|
try:
|
||||||
|
head = f.next()
|
||||||
|
except StopIteration:
|
||||||
|
# empty file, so not encrypted
|
||||||
|
return False
|
||||||
|
|
||||||
if head.startswith(HEADER):
|
if head.startswith(HEADER):
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue