Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

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

Alexander Neumannfa003e89b6a1
diff --git a/cmd/serve/restic/restic.go b/cmd/serve/restic/restic.go
index c7ed3b38c..7e2f697f1 100644
--- a/cmd/serve/restic/restic.go
+++ b/cmd/serve/restic/restic.go
@@ -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 {