diff --git a/services/workflow/workflow/server.py b/services/workflow/workflow/server.py index cc91392846a2b803ac9b0804d8dc743334dae317..e5a8124b8beb414ba3e340fad0318080236e73a0 100644 --- a/services/workflow/workflow/server.py +++ b/services/workflow/workflow/server.py @@ -182,7 +182,7 @@ class WorkflowWorkingDirRestService: }, ) - redirect_url = self.generate_url_from_path(index_path, results_path) + redirect_url = self.generate_url_from_path(str(index_path), str(results_path)) return Response(status_int=http.HTTPStatus.FOUND, location=redirect_url) @view_config(request_method="GET", route_name="get_qa_notes", renderer="json") @@ -202,7 +202,7 @@ class WorkflowWorkingDirRestService: ) qa_notes_text = "" - with open(qa_notes_path, "r") as qa_notes: + with open(str(qa_notes_path), "r") as qa_notes: qa_notes_text = qa_notes.read() return Response(status_int=http.HTTPStatus.OK, json_body={"resp": f"{qa_notes_text}"}) @@ -223,7 +223,7 @@ class WorkflowWorkingDirRestService: }, ) - with open(qa_notes_path, "w") as qa_notes: + with open(str(qa_notes_path), "w") as qa_notes: # sanitize input before writing/persisting # \\u0000 is an invalid character that is incompatible with postgres json columns # from StackOverflow: https://stackoverflow.com/questions/63092267/how-to-handle-api-responsesjson-containing-x00-or-u0000-in-its-data-and-s @@ -309,11 +309,11 @@ class WorkflowWorkingDirRestService: def generate_url_from_path(self, root_path, results_path): current_url = self.request.current_route_url() - return current_url.replace("/weblog", "/dir") + root_path.replace(results_path, "") + "/html/index.html" + return current_url.replace("/weblog", "/dir") + root_path.replace(results_path, "") def generate_qa_notes_path(self, root_path, results_path): current_url = self.request.current_route_url() - return current_url.replace("/qa_notes", "/dir") + root_path.replace(results_path, "") + "/html/qa_notes.html" + return current_url.replace("/qa_notes", "/dir") + root_path.replace(results_path, "") @view_defaults(route_name="workflow_request", renderer="json")