serve restic: When listing return empty list instead of 'null'

This commit is contained in:
Alexander Neumann 2018-03-07 21:59:53 +01:00 committed by Nick Craig-Wood
parent 5114b11d6f
commit fa003e89b6

View File

@ -362,7 +362,9 @@ func (ls *listItems) add(entry fs.DirEntry) {
func (s *server) listObjects(w http.ResponseWriter, r *http.Request, remote string) {
fs.Debugf(remote, "list request")
var ls listItems
// make sure an empty list is returned, and not a 'nil' value
ls := listItems{}
err := walk.Walk(s.f, remote, true, -1, func(path string, entries fs.DirEntries, err error) error {
if err == nil {
for _, entry := range entries {