Skip to content

Commit 240e5a8

Browse files
committed
Fix bug with empty source parameter in schema graph api.
1 parent f31750b commit 240e5a8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

internal/server/server.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ func replyWithUnauthorized(w http.ResponseWriter) {
5252

5353
func getSourceGraph(registry importers.Registry, db schema.Persistor) http.HandlerFunc {
5454
return func(w http.ResponseWriter, r *http.Request) {
55-
sourcesParams, ok := r.URL.Query()["sources"]
5655
importers := []string{}
5756
availableImporters := []string{}
5857

@@ -65,9 +64,12 @@ func getSourceGraph(registry importers.Registry, db schema.Persistor) http.Handl
6564
availableImporters = append(availableImporters, k)
6665
}
6766

68-
if ok && len(sourcesParams) > 0 {
69-
for _, s := range sourcesParams {
70-
importers = append(importers, strings.Split(s, ",")...)
67+
sourcesParams, ok := r.URL.Query()["sources"]
68+
if ok {
69+
if sourcesParams[0] != "" {
70+
for _, s := range sourcesParams {
71+
importers = append(importers, strings.Split(s, ",")...)
72+
}
7173
}
7274
} else {
7375
importers = availableImporters

0 commit comments

Comments
 (0)