fix for caddy web server
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
parent
d5d635b7f3
commit
83b642e98f
1 changed files with 11 additions and 3 deletions
14
http/http.go
14
http/http.go
|
@ -217,9 +217,9 @@ func parseTime(n *html.Node) (t time.Time) {
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Fs) readDir(path string) ([]*entry, error) {
|
func (f *Fs) readDir(p string) ([]*entry, error) {
|
||||||
entries := make([]*entry, 0)
|
entries := make([]*entry, 0)
|
||||||
res, err := f.httpClient.Get(urlJoin(f.endpoint, path))
|
res, err := f.httpClient.Get(urlJoin(f.endpoint, p))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -244,9 +244,17 @@ func (f *Fs) readDir(path string) ([]*entry, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if name == "../" || name == "./" {
|
if name == "../" || name == "./" || name == ".." {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if strings.Index(name, "?") >= 0 || strings.HasPrefix(name, "http") {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
u, err := url.Parse(name)
|
||||||
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
name = path.Clean(u.Path)
|
||||||
e := &entry{
|
e := &entry{
|
||||||
name: strings.TrimRight(name, "/"),
|
name: strings.TrimRight(name, "/"),
|
||||||
url: name,
|
url: name,
|
||||||
|
|
Loading…
Reference in a new issue