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

scanner: fix wrong path being passed to function

Also make rename the parameter in safe_path to make it clear that this
is just a relative path.

Closes fdroid/fdroidserver#791.
This commit is contained in:
Marcus Hoffmann 2020-06-13 02:59:39 +02:00
parent 294799e2f5
commit 3a9f1e845c

View File

@ -200,12 +200,14 @@ def scan_source(build_dir, build=metadata.Build()):
]
]
def safe_path(path):
for sp in safe_paths:
if sp.match(path):
return True
def is_image_file(path):
if imghdr.what(path) is not None:
return True
def safe_path(path_in_build_dir):
for sp in safe_paths:
if sp.match(path_in_build_dir):
return True
return False
gradle_compile_commands = get_gradle_compile_commands(build)
@ -289,7 +291,7 @@ def scan_source(build_dir, build=metadata.Build()):
count += handleproblem('binary', path_in_build_dir, filepath)
elif is_executable(filepath):
if is_binary(filepath) and not safe_path(path_in_build_dir):
if is_binary(filepath) and not (safe_path(path_in_build_dir) or is_image_file(filepath)):
warnproblem(_('executable binary, possibly code'), path_in_build_dir)
for p in scanignore: