filescom: don't make an extra fetch call on each item in a list response

This commit is contained in:
Sam Harrison 2024-08-16 14:53:16 -05:00 committed by Nick Craig-Wood
parent 4e708e59f2
commit be448c9e13

View File

@ -247,18 +247,16 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
func newClientConfig(ctx context.Context, opt *Options) (config files_sdk.Config, err error) {
if opt.Site != "" {
config.Subdomain = opt.Site
_, err = url.Parse(config.Endpoint())
if err != nil {
config.Subdomain = ""
if strings.Contains(opt.Site, ".") {
config.EndpointOverride = opt.Site
} else {
config.Subdomain = opt.Site
}
_, err = url.Parse(config.Endpoint())
if err != nil {
err = fmt.Errorf("invalid domain or subdomain: %v", opt.Site)
return
}
_, err = url.ParseRequestURI(config.Endpoint())
if err != nil {
err = fmt.Errorf("invalid domain or subdomain: %v", opt.Site)
return
}
}
@ -355,15 +353,6 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
continue
}
item, err = f.readMetaDataForPath(ctx, remote)
if err != nil {
if files_sdk.IsNotExist(err) {
continue
}
return nil, err
}
if item.IsDir() {
d := fs.NewDir(remote, item.ModTime())
entries = append(entries, d)