From 3fa12496788669a845b6e24d0a51e3986d056bbf Mon Sep 17 00:00:00 2001 From: WeidiDeng Date: Tue, 24 May 2022 10:57:20 +0800 Subject: [PATCH] fix: use file extension to search for content-type (#1313) --- pkg/webdav/prop.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/webdav/prop.go b/pkg/webdav/prop.go index 7d0b5aa..5e3b4cc 100644 --- a/pkg/webdav/prop.go +++ b/pkg/webdav/prop.go @@ -10,7 +10,9 @@ import ( "encoding/xml" "errors" "fmt" + "mime" "net/http" + "path/filepath" "strconv" "time" @@ -381,7 +383,7 @@ func findContentType(ctx context.Context, fs *filesystem.FileSystem, ls LockSyst //// Rewind file. //_, err = f.Seek(0, os.SEEK_SET) //return ctype, err - return "", nil + return mime.TypeByExtension(filepath.Ext(name)), nil } // ETager is an optional interface for the os.FileInfo objects