diff --git a/cove_rdls/process.py b/cove_rdls/process.py index bb57aa5..09210ae 100644 --- a/cove_rdls/process.py +++ b/cove_rdls/process.py @@ -21,8 +21,6 @@ from libcoveweb2.utils import get_file_type_for_flatten_tool from libcoveweb2.utils import group_data_list_by -import logging -logger = logging.getLogger(__name__) class Sample(ProcessDataTask): def is_processing_applicable(self) -> bool: @@ -53,7 +51,6 @@ def is_processing_needed(self) -> bool: def _add_extention(self, supplied_data_file): input_filename = supplied_data_file.upload_dir_and_filename() filename = input_filename.split("/")[-1] - logger.debug(f"source_method: {supplied_data_file.source_method}, filename: {filename}") if supplied_data_file.source_method == "url": if "." not in filename: content_type = magic.from_file(input_filename, mime=True) @@ -62,13 +59,15 @@ def _add_extention(self, supplied_data_file): file_renamed = f"{input_filename}.json" elif content_type == 'text/csv': file_renamed = f"{input_filename}.csv" - elif content_type == 'application/octet-stream': + elif (content_type == 'application/octet-stream' or content_type == + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'): file_renamed = f"{input_filename}.xlsx" if file_renamed: os.symlink(input_filename, file_renamed) supplied_data_file.filename = file_renamed.split("/")[-1] supplied_data_file.save() - raise Exception(f"add_extention - source_method: {supplied_data_file.source_method}, filename: {filename}, content_type: {content_type}, file_renamed: {file_renamed}") +# raise Exception(f"add_extention - source_method: {supplied_data_file.source_method}, ", +# f"filename: {filename}, content_type: {content_type}, file_renamed: {file_renamed}") def process(self, process_data: dict) -> dict: if self.supplied_data.format == "unknown":