From e6633bc8715488139ae93a3606942835d32b0082 Mon Sep 17 00:00:00 2001 From: Weidi Deng Date: Mon, 23 May 2022 10:50:39 +0800 Subject: [PATCH] =?UTF-8?q?webdav=E9=80=9A=E8=BF=87=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E5=90=8D=E5=88=A4=E6=96=ADcontent-type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 7d0b5aac..5e3b4cc5 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