From be448c9e1359ef7e61517575c93870d3c0ed3662 Mon Sep 17 00:00:00 2001 From: Sam Harrison Date: Fri, 16 Aug 2024 14:53:16 -0500 Subject: [PATCH] filescom: don't make an extra fetch call on each item in a list response --- backend/filescom/filescom.go | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/backend/filescom/filescom.go b/backend/filescom/filescom.go index b14c8cff6..8eb32b320 100644 --- a/backend/filescom/filescom.go +++ b/backend/filescom/filescom.go @@ -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)