@@ -149,11 +149,11 @@ public ResponseEntity<?> newWorkflowFromGithubURLJson(@RequestParam(value="url")
149
149
@ GetMapping (value = {"/workflows/{domain}.com/{owner}/{repoName}/tree/{branch}/**" ,
150
150
"/workflows/{domain}.com/{owner}/{repoName}/blob/{branch}/**" },
151
151
produces = MediaType .APPLICATION_JSON_UTF8_VALUE )
152
- public Workflow getWorkflowByGithubDetailsJson (@ PathVariable ("domain" ) String domain ,
153
- @ PathVariable ("owner" ) String owner ,
154
- @ PathVariable ("repoName" ) String repoName ,
155
- @ PathVariable ("branch" ) String branch ,
156
- HttpServletRequest request ) {
152
+ public Workflow getWorkflowJson (@ PathVariable ("domain" ) String domain ,
153
+ @ PathVariable ("owner" ) String owner ,
154
+ @ PathVariable ("repoName" ) String repoName ,
155
+ @ PathVariable ("branch" ) String branch ,
156
+ HttpServletRequest request ) {
157
157
// The wildcard end of the URL is the path
158
158
String path = (String ) request .getAttribute (HandlerMapping .PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE );
159
159
path = WorkflowController .extractPath (path , 7 );
@@ -170,6 +170,30 @@ public Workflow getWorkflowByGithubDetailsJson(@PathVariable("domain") String do
170
170
}
171
171
}
172
172
173
+ /**
174
+ * Get JSON representation of a workflow from generic git details
175
+ * @param branch The branch of the repository
176
+ * @return The JSON representation of the workflow
177
+ */
178
+ @ GetMapping (value ="/workflows/**/*.git/{branch}/**" ,
179
+ produces = MediaType .APPLICATION_JSON_UTF8_VALUE )
180
+ public Workflow getWorkflowJsonGeneric (@ PathVariable ("branch" ) String branch ,
181
+ HttpServletRequest request ) {
182
+ // The wildcard end of the URL is the path
183
+ String path = (String ) request .getAttribute (HandlerMapping .PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE );
184
+
185
+ // Construct a GitDetails object to search for in the database
186
+ GitDetails gitDetails = WorkflowController .getGitDetails (11 , path , branch );
187
+
188
+ // Get workflow
189
+ Workflow workflowModel = workflowService .getWorkflow (gitDetails );
190
+ if (workflowModel == null ) {
191
+ throw new WorkflowNotFoundException ();
192
+ } else {
193
+ return workflowModel ;
194
+ }
195
+ }
196
+
173
197
/**
174
198
* Query progress of a queued workflow
175
199
* @param queueID The queued workflow ID to check
0 commit comments