switched to PathUnescape

This commit is contained in:
Nick Kratzke 2021-02-03 21:16:30 +01:00
parent 3ed042db71
commit d02a1ebcd2

View File

@ -5,7 +5,9 @@ import (
"encoding/xml" "encoding/xml"
"io" "io"
"net/http" "net/http"
"net/url"
"os" "os"
pathpkg "path"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -136,9 +138,11 @@ func (c *Client) ReadDir(path string) ([]os.FileInfo, error) {
if p := getProps(r, "200"); p != nil { if p := getProps(r, "200"); p != nil {
f := new(File) f := new(File)
if ps, err := url.PathUnescape(r.Href); err == nil {
f.name = p.Name f.name = pathpkg.Base(ps)
} else {
f.name = p.Name
}
f.path = path + f.name f.path = path + f.name
f.modified = parseModified(&p.Modified) f.modified = parseModified(&p.Modified)
f.etag = p.ETag f.etag = p.ETag