Skip to content

Commit b6189a0

Browse files
author
Mark Robinson
committed
Fix creation of workflows from index page
1 parent d9ed7fb commit b6189a0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/main/java/org/commonwl/viewer/web/WorkflowController.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,14 @@ public ModelAndView newWorkflowFromGithubURL(@Valid WorkflowForm workflowForm, B
103103
} else {
104104
// Get workflow or create if does not exist
105105
Workflow workflow = workflowService.getWorkflow(githubInfo);
106-
107-
// Runtime error if workflow could not be generated
108106
if (workflow == null) {
109-
bindingResult.rejectValue("githubURL", "githubURL.parsingError");
110-
return new ModelAndView("index");
107+
workflow = workflowService.createWorkflow(githubInfo);
108+
109+
// Runtime error if workflow could not be generated
110+
if (workflow == null) {
111+
bindingResult.rejectValue("githubURL", "githubURL.parsingError");
112+
return new ModelAndView("index");
113+
}
111114
}
112115

113116
// Redirect to the workflow
@@ -141,7 +144,7 @@ public ModelAndView getWorkflowByGithubDetails(@Value("${applicationURL}") Strin
141144
String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
142145
int pathStartIndex = StringUtils.ordinalIndexOf(path, "/", 7);
143146
if (pathStartIndex > -1 && pathStartIndex < path.length() - 1) {
144-
path = path.substring(pathStartIndex + 1);
147+
path = path.substring(pathStartIndex + 1).replaceAll("\\/$", "");
145148
} else {
146149
path = null;
147150
}

0 commit comments

Comments
 (0)