diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index 3e7eed530..c29cf2148 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -1708,6 +1708,8 @@ def get_file_from_request() -> Any: return request_file +# process_model_id uses forward slashes on all OSes +# this seems to return an object where process_model.id has backslashes on windows def get_process_model(process_model_id: str) -> ProcessModelInfo: """Get_process_model.""" process_model = None diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py index d4fa5647b..964981a85 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py @@ -172,7 +172,6 @@ class ProcessModelService(FileSystemService): cls, relative_path: str ) -> ProcessModelInfo: """Get_process_model_from_relative_path.""" - process_group_identifier, _ = os.path.split(relative_path) path = os.path.join(FileSystemService.root_path(), relative_path) return cls.__scan_process_model(path) @@ -430,6 +429,9 @@ class ProcessModelService(FileSystemService): # process_group.process_groups.sort() return process_group + # path might have backslashes on windows, not sure + # not sure if os.path.join converts forward slashes in the relative_path argument to backslashes: + # path = os.path.join(FileSystemService.root_path(), relative_path) @classmethod def __scan_process_model( cls, @@ -446,6 +448,10 @@ class ProcessModelService(FileSystemService): data.pop("process_group_id") # we don't save `id` in the json file, so we add it back in here. relative_path = os.path.relpath(path, FileSystemService.root_path()) + + # even on windows, use forward slashes for ids + relative_path = relative_path.replace("\\", "/") + data["id"] = relative_path process_model_info = ProcessModelInfo(**data) if process_model_info is None: