"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
serve dlna: fix missing mime types on Android causing missing videos
Nick Craig-Wood39ae7c7ac094
diff --git a/cmd/serve/dlna/cds.go b/cmd/serve/dlna/cds.goindex f5a2d45cb..bb1aae7d9 100644--- a/cmd/serve/dlna/cds.go+++ b/cmd/serve/dlna/cds.go@@ -1,6 +1,7 @@package dlnaimport (+ "context""encoding/xml""fmt""log"@@ -33,7 +34,7 @@ var mediaMimeTypeRegexp = regexp.MustCompile("^(video|audio|image)/")// Turns the given entry and DMS host into a UPnP object. A nil object is// returned if the entry is not of interest.-func (cds *contentDirectoryService) cdsObjectToUpnpavObject(cdsObject object, fileInfo os.FileInfo, host string) (ret interface{}, err error) {+func (cds *contentDirectoryService) cdsObjectToUpnpavObject(cdsObject object, fileInfo vfs.Node, host string) (ret interface{}, err error) {obj := upnpav.Object{ID: cdsObject.ID(),Restricted: 1,@@ -51,7 +52,15 @@ func (cds *contentDirectoryService) cdsObjectToUpnpavObject(cdsObject object, fireturn}- mimeType := fs.MimeTypeFromName(fileInfo.Name())+ // Read the mime type from the fs.Object if possible,+ // otherwise fall back to working out what it is from the file path.+ var mimeType string+ if o, ok := fileInfo.DirEntry().(fs.Object); ok {+ mimeType = fs.MimeType(context.TODO(), o)+ } else {+ mimeType = fs.MimeTypeFromName(fileInfo.Name())+ }+mediaType := mediaMimeTypeRegexp.FindStringSubmatch(mimeType)if mediaType == nil {return