From d54384e53f8a0022763e0d7980b35b7a0a288074 Mon Sep 17 00:00:00 2001 From: Riley Windsor Date: Tue, 29 Oct 2024 13:03:13 -0400 Subject: [PATCH] update check for jar file --- apps/runner/runner.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/runner/runner.py b/apps/runner/runner.py index 11f054a3..b084ba48 100644 --- a/apps/runner/runner.py +++ b/apps/runner/runner.py @@ -173,8 +173,16 @@ def determine_experiment_file_type(filepath: str): filetype = ExperimentType.UNKNOWN if 'Python script' in rawfiletype or 'python3' in rawfiletype: filetype = ExperimentType.PYTHON - elif 'Java archive data (JAR)' in rawfiletype: - filetype = ExperimentType.JAVA + elif 'Zip archive data' in rawfiletype: + # check for META-INF/MANIFEST.MF in file + try: + file = open(filepath, "r") + contents = file.read() + if "META-INF/MANIFEST.MF" in contents: + filetype = ExperimentType.JAVA + except FileNotFoundError as e: + explogger.error(f"{filepath} could not be read to determine if it is a jar file!") + raise e elif 'ELF 64-bit LSB' in rawfiletype: filetype = ExperimentType.C