about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--svc/handlers.go6
-rw-r--r--svc/query.go2
2 files changed, 7 insertions, 1 deletions
diff --git a/svc/handlers.go b/svc/handlers.go
index ee58622..7ce4b77 100644
--- a/svc/handlers.go
+++ b/svc/handlers.go
@@ -45,6 +45,12 @@ func getEtagFromTime(modtime time.Time) string {
 // responses.
 func getEtag(data []byte) string {
 	bytes := fnv.New32().Sum(data)
+	if bytes == nil {
+		return ""
+	}
+	if len(bytes) < 16 {
+		return fmt.Sprintf("%x", bytes)
+	}
 	return fmt.Sprintf("%x", bytes[:16])
 }
 
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)...)