Skip to content

Commit

Permalink
close files properly, handle xci correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
themoonisacheese committed Oct 19, 2023
1 parent 1a0922c commit 9cfa0fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cd autoverif
python3 -m venv .venv
#Windows:
.venv.\Scripts\activate.bat
.venv\Scripts\activate.bat
#Linux:
source .venv/bin/activate
Expand Down
16 changes: 13 additions & 3 deletions verif.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,25 @@ def verify(file):
tmpfolder =os.path.join(dir,'tmp')
feed=''
buffer = 65536

f = Fs.Nsp(filename, 'rb')

if filename.lower().endswith('.nsp') or filename.lower().endswith('.nsz'):
f = Fs.Nsp(filename, 'rb')
elif filename.lower().endswith('.xcz') or filename.lower().endswith('.xci'):
f = Fs.Xci(filename, 'rb')
else:
raise Exception("{1} does not have the appropriate extension".format(filename))


check,feed=f.verify()

if check == False:
f.flush()
f.close()
return False

verdict,headerlist,feed=f.verify_sig(feed,tmpfolder)
if verdict == False:
f.flush()
f.close()
return False
print(filename)
if filename.endswith('.nsz') :
Expand Down

0 comments on commit 9cfa0fc

Please sign in to comment.