Skip to content

Commit 55a712c

Browse files
committed
Error messages for SSH URLs or submodule URLs
1 parent bf739c5 commit 55a712c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/main/java/org/commonwl/view/workflow/WorkflowController.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.commonwl.view.git.GitDetails;
2525
import org.commonwl.view.graphviz.GraphVizService;
2626
import org.eclipse.jgit.api.errors.GitAPIException;
27+
import org.eclipse.jgit.api.errors.TransportException;
2728
import org.slf4j.Logger;
2829
import org.slf4j.LoggerFactory;
2930
import org.springframework.beans.factory.annotation.Autowired;
@@ -120,6 +121,9 @@ public ModelAndView createWorkflow(@Valid WorkflowForm workflowForm, BindingResu
120121
if (workflow == null) {
121122
try {
122123
workflow = workflowService.createQueuedWorkflow(gitInfo).getTempRepresentation();
124+
} catch (TransportException ex) {
125+
bindingResult.rejectValue("url", "git.sshError");
126+
return new ModelAndView("index");
123127
} catch (GitAPIException ex) {
124128
bindingResult.rejectValue("url", "git.retrievalError");
125129
logger.error("Git API Error", ex);
@@ -450,9 +454,10 @@ private ModelAndView getWorkflow(GitDetails gitDetails, RedirectAttributes redir
450454
if (!errors.hasErrors()) {
451455
try {
452456
queued = workflowService.createQueuedWorkflow(gitDetails);
457+
} catch (TransportException ex) {
458+
errors.rejectValue("url", "git.sshError", "SSH URLs are not supported, please provide a HTTPS URL for the repository or submodules");
453459
} catch (GitAPIException ex) {
454460
errors.rejectValue("url", "git.retrievalError", "The workflow could not be retrieved from the Git repository using the details given");
455-
logger.error("Git API Error", ex);
456461
} catch (WorkflowNotFoundException ex) {
457462
errors.rejectValue("url", "git.pathTraversal", "The path given did not resolve to a location within the repository");
458463
} catch (IOException ex) {

src/main/resources/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ path.emptyOrWhitespace = You must provide a path to the workflow within the repo
44

55
git.retrievalError = The workflow could not be retrieved from the Git repository using the details given
66
git.pathTraversal = The path given did not resolve to a location within the repository
7+
git.sshError = SSH URLs are not supported, please provide a HTTPS URL for the repository or submodules
78

89
url.parsingError = An unexpected error occurred when parsing the workflow

0 commit comments

Comments
 (0)