Edited script so that workflow does not blow up when it reads a unicode file

This commit is contained in:
molangning 2023-11-26 12:52:46 +08:00
parent 7e128ab391
commit ab618c708b

View File

@ -18,17 +18,16 @@ for i in files:
exit(2)
for i in files:
f=open(i,"r")
contents=f.read()
contents=open(i,"rb").read()
if contents[-1] == '\n':
if contents[-1] == b'\n':
print("[!] %s ends with a new line!"%(i))
exit(2)
print("[+] %s passed new line check!"%(i))
counter=1
for line in contents.split('\n'):
for line in contents.split(b'\n'):
if len(line)==0:
print("[!] %s has an empty entry at line %i!"%(i,counter))
exit(2)