From 33816041d6e9fabd026323d09ac29ecea23baa36 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Wed, 9 Dec 2015 17:08:29 +0900 Subject: [PATCH] Use href instead of displayname for Name() --- client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index 585f730..bf41b16 100644 --- a/client.go +++ b/client.go @@ -6,7 +6,9 @@ import ( "encoding/xml" "io" "net/http" + "net/url" "os" + pathpkg "path" "strings" "time" ) @@ -84,7 +86,11 @@ func (c *Client) ReadDir(path string) ([]os.FileInfo, error) { if p := getProps(r, "200"); p != nil { f := new(File) - f.name = p.Name + if ps, err := url.QueryUnescape(r.Href); err == nil { + f.name = pathpkg.Base(ps) + } else { + f.name = p.Name + } f.path = path + f.name if p.Type.Local == "collection" {