From 3bb022fb6f5c6d273e2787e10a28e821c88734d7 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Mon, 16 Mar 2020 14:49:06 -0400 Subject: eliminated panic when serving requests from empty registry when generating an etag from a query that returns no results, indexing into the byte slice caused that thread to panic. now checking for a nil byte slice or a small byte slice in handlers.go:46:getEtag() on nil byte slice, return empty string for etag. on small byte slice, don't truncate it, but return the whole thing. --- svc/query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svc/query.go') diff --git a/svc/query.go b/svc/query.go index 7047df3..8f22838 100644 --- a/svc/query.go +++ b/svc/query.go @@ -61,7 +61,7 @@ func dedupe(list []string) []string { // appending each entry to a byte slice, and adding // newlines where appropriate. func parseQueryOut(out []string) []byte { - var data []byte + data := make([]byte, 0) for i, e := range out { data = append(data, []byte(e)...) -- cgit 1.4.1-2-gfad0