1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-09 17:00:12 +01:00

Scanner: handle utf8 errors more gracefully

Fixes #226
This commit is contained in:
est31 2016-11-02 12:51:15 +01:00
parent f90adcc912
commit af22f18296

View File

@ -199,7 +199,7 @@ def scan_source(build_dir, root_dir, build):
elif ext == 'java': elif ext == 'java':
if not os.path.isfile(fp): if not os.path.isfile(fp):
continue continue
with open(fp, 'r', encoding='utf8') as f: with open(fp, 'r', encoding='utf8', errors='replace') as f:
for line in f: for line in f:
if 'DexClassLoader' in line: if 'DexClassLoader' in line:
count += handleproblem('DexClassLoader', fd, fp) count += handleproblem('DexClassLoader', fd, fp)
@ -208,7 +208,7 @@ def scan_source(build_dir, root_dir, build):
elif ext == 'gradle': elif ext == 'gradle':
if not os.path.isfile(fp): if not os.path.isfile(fp):
continue continue
with open(fp, 'r', encoding='utf8') as f: with open(fp, 'r', encoding='utf8', errors='replace') as f:
lines = f.readlines() lines = f.readlines()
for i, line in enumerate(lines): for i, line in enumerate(lines):
if is_used_by_gradle(line): if is_used_by_gradle(line):