mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 09:04:52 +01:00
filescom: don't make an extra fetch call on each item in a list response
This commit is contained in:
parent
4e708e59f2
commit
be448c9e13
@ -247,20 +247,18 @@ 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) {
|
func newClientConfig(ctx context.Context, opt *Options) (config files_sdk.Config, err error) {
|
||||||
if opt.Site != "" {
|
if opt.Site != "" {
|
||||||
config.Subdomain = opt.Site
|
if strings.Contains(opt.Site, ".") {
|
||||||
|
|
||||||
_, err = url.Parse(config.Endpoint())
|
|
||||||
if err != nil {
|
|
||||||
config.Subdomain = ""
|
|
||||||
config.EndpointOverride = opt.Site
|
config.EndpointOverride = opt.Site
|
||||||
|
} else {
|
||||||
|
config.Subdomain = opt.Site
|
||||||
|
}
|
||||||
|
|
||||||
_, err = url.Parse(config.Endpoint())
|
_, err = url.ParseRequestURI(config.Endpoint())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("invalid domain or subdomain: %v", opt.Site)
|
err = fmt.Errorf("invalid domain or subdomain: %v", opt.Site)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
config = config.Init().SetCustomClient(fshttp.NewClient(ctx))
|
config = config.Init().SetCustomClient(fshttp.NewClient(ctx))
|
||||||
|
|
||||||
@ -355,15 +353,6 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
item, err = f.readMetaDataForPath(ctx, remote)
|
|
||||||
if err != nil {
|
|
||||||
if files_sdk.IsNotExist(err) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if item.IsDir() {
|
if item.IsDir() {
|
||||||
d := fs.NewDir(remote, item.ModTime())
|
d := fs.NewDir(remote, item.ModTime())
|
||||||
entries = append(entries, d)
|
entries = append(entries, d)
|
||||||
|
Loading…
Reference in New Issue
Block a user