From 5fd5bbcaeb3914f93bf7742c015a8c7a1f990ec3 Mon Sep 17 00:00:00 2001
From: jsheckar <jsheckar@nrao.edu>
Date: Mon, 15 Aug 2022 13:49:35 -0600
Subject: [PATCH] uniform_weblog_digging: Strings where strings are wanted, and
 the extended path no longer necessary on URL generation

---
 services/workflow/workflow/server.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/services/workflow/workflow/server.py b/services/workflow/workflow/server.py
index cc9139284..e5a8124b8 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")
-- 
GitLab