@@ -140,7 +140,7 @@ func serveDevfile(c *gin.Context) {
140
140
func serveDevfileStarterProject (c * gin.Context ) {
141
141
devfileName := c .Param ("devfileName" )
142
142
starterProjectName := c .Param ("starterProjectName" )
143
- devfileBytes := fetchDevfile (c , devfileName )
143
+ devfileBytes , devfileIndexSchema := fetchDevfile (c , devfileName )
144
144
145
145
if len (devfileBytes ) == 0 {
146
146
// fetchDevfile was unsuccessful (error or not found)
@@ -273,7 +273,7 @@ func buildIndexAPIResponse(c *gin.Context) {
273
273
}
274
274
275
275
// fetchDevfile retrieves a specified devfile stored under /registry/**/<devfileName>
276
- func fetchDevfile (c * gin.Context , devfileName string ) []byte {
276
+ func fetchDevfile (c * gin.Context , devfileName string ) ( []byte , indexSchema. Schema ) {
277
277
var index []indexSchema.Schema
278
278
bytes , err := ioutil .ReadFile (indexPath )
279
279
if err != nil {
@@ -282,7 +282,7 @@ func fetchDevfile(c *gin.Context, devfileName string) []byte {
282
282
"error" : err .Error (),
283
283
"status" : fmt .Sprintf ("failed to pull the devfile of %s" , devfileName ),
284
284
})
285
- return make ([]byte , 0 )
285
+ return make ([]byte , 0 ), indexSchema. Schema {}
286
286
}
287
287
err = json .Unmarshal (bytes , & index )
288
288
if err != nil {
@@ -291,7 +291,7 @@ func fetchDevfile(c *gin.Context, devfileName string) []byte {
291
291
"error" : err .Error (),
292
292
"status" : fmt .Sprintf ("failed to pull the devfile of %s" , devfileName ),
293
293
})
294
- return make ([]byte , 0 )
294
+ return make ([]byte , 0 ), indexSchema. Schema {}
295
295
}
296
296
297
297
// Reuse 'bytes' for devfile bytes, assign empty
@@ -314,18 +314,18 @@ func fetchDevfile(c *gin.Context, devfileName string) []byte {
314
314
"error" : err .Error (),
315
315
"status" : fmt .Sprintf ("failed to pull the devfile of %s" , devfileName ),
316
316
})
317
- return make ([]byte , 0 )
317
+ return make ([]byte , 0 ), devfileIndex
318
318
}
319
319
320
- return bytes
320
+ return bytes , devfileIndex
321
321
}
322
322
}
323
323
324
324
c .JSON (http .StatusNotFound , gin.H {
325
325
"status" : fmt .Sprintf ("the devfile of %s didn't exist" , devfileName ),
326
326
})
327
327
328
- return bytes
328
+ return bytes , indexSchema. Schema {}
329
329
}
330
330
331
331
/** source from serveDevfile **/
0 commit comments