"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
dlna: count the number of children in the response to BrowseMetadata
Dan Walters2f10472df37c
diff --git a/cmd/serve/dlna/cds.go b/cmd/serve/dlna/cds.goindex 2e77162a3..9b7d1ad59 100644--- a/cmd/serve/dlna/cds.go+++ b/cmd/serve/dlna/cds.go@@ -77,10 +77,17 @@ func (cds *contentDirectoryService) cdsObjectToUpnpavObject(cdsObject object, fi}if fileInfo.IsDir() {+ children, err := cds.readContainer(cdsObject, host)+ if err != nil {+ return nil, err+ }+obj.Class = "object.container.storageFolder"obj.Title = fileInfo.Name()- ret = upnpav.Container{Object: obj}- return+ return upnpav.Container{+ Object: obj,+ ChildCount: len(children),+ }, nil}if !fileInfo.Mode().IsRegular() {diff --git a/cmd/serve/dlna/dlna_test.go b/cmd/serve/dlna/dlna_test.goindex 7fb5ce395..c83ded016 100644--- a/cmd/serve/dlna/dlna_test.go+++ b/cmd/serve/dlna/dlna_test.go@@ -3,6 +3,7 @@ package dlnaimport ("context""fmt"+ "html""io/ioutil""net/http""net/url"@@ -118,6 +119,9 @@ func TestContentDirectoryBrowseMetadata(t *testing.T) {assert.Equal(t, http.StatusOK, resp.StatusCode)body, err := ioutil.ReadAll(resp.Body)require.NoError(t, err)- require.Contains(t, string(body), "<container ")- require.NotContains(t, string(body), "<item ")+ // expect a <container> element+ require.Contains(t, string(body), html.EscapeString("<container "))+ require.NotContains(t, string(body), html.EscapeString("<item "))+ // with a non-zero childCount+ require.Contains(t, string(body), html.EscapeString(`childCount="1"`))}