forked from TrueCloudLab/rclone
parent
d69b96a94c
commit
8b96933e58
38 changed files with 48 additions and 48 deletions
|
@ -273,7 +273,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
ReadMimeType: true,
|
ReadMimeType: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
|
|
||||||
// Renew the token in the background
|
// Renew the token in the background
|
||||||
f.tokenRenewer = oauthutil.NewRenew(f.String(), ts, func() error {
|
f.tokenRenewer = oauthutil.NewRenew(f.String(), ts, func() error {
|
||||||
|
|
|
@ -432,7 +432,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
BucketBasedRootOK: true,
|
BucketBasedRootOK: true,
|
||||||
SetTier: true,
|
SetTier: true,
|
||||||
GetTier: true,
|
GetTier: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
u *url.URL
|
u *url.URL
|
||||||
|
|
|
@ -438,7 +438,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
WriteMimeType: true,
|
WriteMimeType: true,
|
||||||
BucketBased: true,
|
BucketBased: true,
|
||||||
BucketBasedRootOK: true,
|
BucketBasedRootOK: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
// Set the test flag if required
|
// Set the test flag if required
|
||||||
if opt.TestMode != "" {
|
if opt.TestMode != "" {
|
||||||
testMode := strings.TrimSpace(opt.TestMode)
|
testMode := strings.TrimSpace(opt.TestMode)
|
||||||
|
|
|
@ -407,7 +407,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
f.srv.SetErrorHandler(errorHandler)
|
f.srv.SetErrorHandler(errorHandler)
|
||||||
|
|
||||||
// If using an accessToken, set the Authorization header
|
// If using an accessToken, set the Authorization header
|
||||||
|
@ -462,7 +462,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
f.features.Fill(&tempF)
|
f.features.Fill(ctx, &tempF)
|
||||||
// XXX: update the old f here instead of returning tempF, since
|
// XXX: update the old f here instead of returning tempF, since
|
||||||
// `features` were already filled with functions having *f as a receiver.
|
// `features` were already filled with functions having *f as a receiver.
|
||||||
// See https://github.com/rclone/rclone/issues/2182
|
// See https://github.com/rclone/rclone/issues/2182
|
||||||
|
|
2
backend/cache/cache.go
vendored
2
backend/cache/cache.go
vendored
|
@ -512,7 +512,7 @@ func NewFs(ctx context.Context, name, rootPath string, m configmap.Mapper) (fs.F
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
DuplicateFiles: false, // storage doesn't permit this
|
DuplicateFiles: false, // storage doesn't permit this
|
||||||
}).Fill(f).Mask(wrappedFs).WrapsFs(f, wrappedFs)
|
}).Fill(ctx, f).Mask(ctx, wrappedFs).WrapsFs(f, wrappedFs)
|
||||||
// override only those features that use a temp fs and it doesn't support them
|
// override only those features that use a temp fs and it doesn't support them
|
||||||
//f.features.ChangeNotify = f.ChangeNotify
|
//f.features.ChangeNotify = f.ChangeNotify
|
||||||
if f.opt.TempWritePath != "" {
|
if f.opt.TempWritePath != "" {
|
||||||
|
|
|
@ -294,7 +294,7 @@ func NewFs(ctx context.Context, name, rpath string, m configmap.Mapper) (fs.Fs,
|
||||||
BucketBased: true,
|
BucketBased: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
ServerSideAcrossConfigs: true,
|
ServerSideAcrossConfigs: true,
|
||||||
}).Fill(f).Mask(baseFs).WrapsFs(f, baseFs)
|
}).Fill(ctx, f).Mask(ctx, baseFs).WrapsFs(f, baseFs)
|
||||||
|
|
||||||
f.features.Disable("ListR") // Recursive listing may cause chunker skip files
|
f.features.Disable("ListR") // Recursive listing may cause chunker skip files
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ func NewFs(ctx context.Context, name, rpath string, m configmap.Mapper) (fs.Fs,
|
||||||
SetTier: true,
|
SetTier: true,
|
||||||
GetTier: true,
|
GetTier: true,
|
||||||
ServerSideAcrossConfigs: opt.ServerSideAcrossConfigs,
|
ServerSideAcrossConfigs: opt.ServerSideAcrossConfigs,
|
||||||
}).Fill(f).Mask(wrappedFs).WrapsFs(f, wrappedFs)
|
}).Fill(ctx, f).Mask(ctx, wrappedFs).WrapsFs(f, wrappedFs)
|
||||||
|
|
||||||
return f, err
|
return f, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -953,7 +953,7 @@ func configTeamDrive(ctx context.Context, opt *Options, m configmap.Mapper, name
|
||||||
if !config.Confirm(false) {
|
if !config.Confirm(false) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
f, err := newFs(name, "", m)
|
f, err := newFs(ctx, name, "", m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to make Fs to list teamdrives")
|
return errors.Wrap(err, "failed to make Fs to list teamdrives")
|
||||||
}
|
}
|
||||||
|
@ -1065,7 +1065,7 @@ func (f *Fs) setUploadCutoff(cs fs.SizeSuffix) (old fs.SizeSuffix, err error) {
|
||||||
//
|
//
|
||||||
// It constructs a valid Fs but doesn't attempt to figure out whether
|
// It constructs a valid Fs but doesn't attempt to figure out whether
|
||||||
// it is a file or a directory.
|
// it is a file or a directory.
|
||||||
func newFs(name, path string, m configmap.Mapper) (*Fs, error) {
|
func newFs(ctx context.Context, name, path string, m configmap.Mapper) (*Fs, error) {
|
||||||
// Parse config into Options struct
|
// Parse config into Options struct
|
||||||
opt := new(Options)
|
opt := new(Options)
|
||||||
err := configstruct.Set(m, opt)
|
err := configstruct.Set(m, opt)
|
||||||
|
@ -1109,7 +1109,7 @@ func newFs(name, path string, m configmap.Mapper) (*Fs, error) {
|
||||||
WriteMimeType: true,
|
WriteMimeType: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
ServerSideAcrossConfigs: opt.ServerSideAcrossConfigs,
|
ServerSideAcrossConfigs: opt.ServerSideAcrossConfigs,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
|
|
||||||
// Create a new authorized Drive client.
|
// Create a new authorized Drive client.
|
||||||
f.client = oAuthClient
|
f.client = oAuthClient
|
||||||
|
@ -1130,7 +1130,7 @@ func newFs(name, path string, m configmap.Mapper) (*Fs, error) {
|
||||||
|
|
||||||
// NewFs constructs an Fs from the path, container:path
|
// NewFs constructs an Fs from the path, container:path
|
||||||
func NewFs(ctx context.Context, name, path string, m configmap.Mapper) (fs.Fs, error) {
|
func NewFs(ctx context.Context, name, path string, m configmap.Mapper) (fs.Fs, error) {
|
||||||
f, err := newFs(name, path, m)
|
f, err := newFs(ctx, name, path, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -414,7 +414,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
f.opt.SharedFolders = false
|
f.opt.SharedFolders = false
|
||||||
}
|
}
|
||||||
|
|
||||||
f.features.Fill(f)
|
f.features.Fill(ctx, f)
|
||||||
|
|
||||||
// If root starts with / then use the actual root
|
// If root starts with / then use the actual root
|
||||||
if strings.HasPrefix(root, "/") {
|
if strings.HasPrefix(root, "/") {
|
||||||
|
|
|
@ -193,7 +193,7 @@ func NewFs(ctx context.Context, name string, root string, config configmap.Mappe
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
DuplicateFiles: true,
|
DuplicateFiles: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
|
|
||||||
client := fshttp.NewClient(fs.Config)
|
client := fshttp.NewClient(fs.Config)
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ func NewFs(ctx context.Context, name string, root string, config configmap.Mappe
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
f.features.Fill(&tempF)
|
f.features.Fill(ctx, &tempF)
|
||||||
// XXX: update the old f here instead of returning tempF, since
|
// XXX: update the old f here instead of returning tempF, since
|
||||||
// `features` were already filled with functions having *f as a receiver.
|
// `features` were already filled with functions having *f as a receiver.
|
||||||
// See https://github.com/rclone/rclone/issues/2182
|
// See https://github.com/rclone/rclone/issues/2182
|
||||||
|
|
|
@ -339,7 +339,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (ff fs.Fs
|
||||||
}
|
}
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
// Make a connection and pool it to return errors early
|
// Make a connection and pool it to return errors early
|
||||||
c, err := f.getFtpConnection()
|
c, err := f.getFtpConnection()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -441,7 +441,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
WriteMimeType: true,
|
WriteMimeType: true,
|
||||||
BucketBased: true,
|
BucketBased: true,
|
||||||
BucketBasedRootOK: true,
|
BucketBasedRootOK: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
|
|
||||||
// Create a new authorized Drive client.
|
// Create a new authorized Drive client.
|
||||||
f.client = oAuthClient
|
f.client = oAuthClient
|
||||||
|
|
|
@ -279,7 +279,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
}
|
}
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
ReadMimeType: true,
|
ReadMimeType: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
f.srv.SetErrorHandler(errorHandler)
|
f.srv.SetErrorHandler(errorHandler)
|
||||||
|
|
||||||
_, _, pattern := patterns.match(f.root, "", true)
|
_, _, pattern := patterns.match(f.root, "", true)
|
||||||
|
|
|
@ -219,7 +219,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
}
|
}
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
if isFile {
|
if isFile {
|
||||||
return f, fs.ErrorIsFile
|
return f, fs.ErrorIsFile
|
||||||
}
|
}
|
||||||
|
|
|
@ -720,7 +720,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
ReadMimeType: true,
|
ReadMimeType: true,
|
||||||
WriteMimeType: true,
|
WriteMimeType: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
f.srv.SetErrorHandler(errorHandler)
|
f.srv.SetErrorHandler(errorHandler)
|
||||||
if opt.TrashedOnly { // we cannot support showing Trashed Files when using ListR right now
|
if opt.TrashedOnly { // we cannot support showing Trashed Files when using ListR right now
|
||||||
f.features.ListR = nil
|
f.features.ListR = nil
|
||||||
|
|
|
@ -287,7 +287,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (ff fs.Fs
|
||||||
DuplicateFiles: false,
|
DuplicateFiles: false,
|
||||||
BucketBased: false,
|
BucketBased: false,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
for _, m := range mounts {
|
for _, m := range mounts {
|
||||||
if opt.MountID != "" {
|
if opt.MountID != "" {
|
||||||
if m.Id == opt.MountID {
|
if m.Id == opt.MountID {
|
||||||
|
|
|
@ -245,7 +245,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
IsLocal: true,
|
IsLocal: true,
|
||||||
SlowHash: true,
|
SlowHash: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
if opt.FollowSymlinks {
|
if opt.FollowSymlinks {
|
||||||
f.lstat = os.Stat
|
f.lstat = os.Stat
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
// Can copy/move across mailru configs (almost, thus true here), but
|
// Can copy/move across mailru configs (almost, thus true here), but
|
||||||
// only when they share common account (this is checked in Copy/Move).
|
// only when they share common account (this is checked in Copy/Move).
|
||||||
ServerSideAcrossConfigs: true,
|
ServerSideAcrossConfigs: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
|
|
||||||
// Override few config settings and create a client
|
// Override few config settings and create a client
|
||||||
clientConfig := *fs.Config
|
clientConfig := *fs.Config
|
||||||
|
|
|
@ -233,7 +233,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
DuplicateFiles: true,
|
DuplicateFiles: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
|
|
||||||
// Find the root node and check if it is a file or not
|
// Find the root node and check if it is a file or not
|
||||||
_, err = f.findRoot(false)
|
_, err = f.findRoot(false)
|
||||||
|
|
|
@ -241,7 +241,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
WriteMimeType: true,
|
WriteMimeType: true,
|
||||||
BucketBased: true,
|
BucketBased: true,
|
||||||
BucketBasedRootOK: true,
|
BucketBasedRootOK: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
if f.rootBucket != "" && f.rootDirectory != "" {
|
if f.rootBucket != "" && f.rootDirectory != "" {
|
||||||
od := buckets.getObjectData(f.rootBucket, f.rootDirectory)
|
od := buckets.getObjectData(f.rootBucket, f.rootDirectory)
|
||||||
if od != nil {
|
if od != nil {
|
||||||
|
|
|
@ -633,7 +633,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
ReadMimeType: true,
|
ReadMimeType: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
ServerSideAcrossConfigs: opt.ServerSideAcrossConfigs,
|
ServerSideAcrossConfigs: opt.ServerSideAcrossConfigs,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
f.srv.SetErrorHandler(errorHandler)
|
f.srv.SetErrorHandler(errorHandler)
|
||||||
|
|
||||||
// Renew the token in the background
|
// Renew the token in the background
|
||||||
|
|
|
@ -216,7 +216,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
|
|
||||||
// Find the current root
|
// Find the current root
|
||||||
err = f.dirCache.FindRoot(ctx, false)
|
err = f.dirCache.FindRoot(ctx, false)
|
||||||
|
|
|
@ -304,7 +304,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CaseInsensitive: false,
|
CaseInsensitive: false,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
f.srv.SetErrorHandler(errorHandler)
|
f.srv.SetErrorHandler(errorHandler)
|
||||||
|
|
||||||
// Renew the token in the background
|
// Renew the token in the background
|
||||||
|
|
|
@ -266,7 +266,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
ReadMimeType: true,
|
ReadMimeType: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
f.srv.SetErrorHandler(errorHandler)
|
f.srv.SetErrorHandler(errorHandler)
|
||||||
|
|
||||||
// Renew the token in the background
|
// Renew the token in the background
|
||||||
|
@ -302,7 +302,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
f.features.Fill(&tempF)
|
f.features.Fill(ctx, &tempF)
|
||||||
// XXX: update the old f here instead of returning tempF, since
|
// XXX: update the old f here instead of returning tempF, since
|
||||||
// `features` were already filled with functions having *f as a receiver.
|
// `features` were already filled with functions having *f as a receiver.
|
||||||
// See https://github.com/rclone/rclone/issues/2182
|
// See https://github.com/rclone/rclone/issues/2182
|
||||||
|
|
|
@ -95,7 +95,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (f fs.Fs,
|
||||||
DuplicateFiles: true,
|
DuplicateFiles: true,
|
||||||
ReadMimeType: true,
|
ReadMimeType: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(p)
|
}).Fill(ctx, p)
|
||||||
p.dirCache = dircache.New(root, "0", p)
|
p.dirCache = dircache.New(root, "0", p)
|
||||||
// Find the current root
|
// Find the current root
|
||||||
err = p.dirCache.FindRoot(ctx, false)
|
err = p.dirCache.FindRoot(ctx, false)
|
||||||
|
|
|
@ -357,7 +357,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
BucketBased: true,
|
BucketBased: true,
|
||||||
BucketBasedRootOK: true,
|
BucketBasedRootOK: true,
|
||||||
SlowModTime: true,
|
SlowModTime: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
|
|
||||||
if f.rootBucket != "" && f.rootDirectory != "" {
|
if f.rootBucket != "" && f.rootDirectory != "" {
|
||||||
// Check to see if the object exists
|
// Check to see if the object exists
|
||||||
|
|
|
@ -1620,7 +1620,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
SetTier: true,
|
SetTier: true,
|
||||||
GetTier: true,
|
GetTier: true,
|
||||||
SlowModTime: true,
|
SlowModTime: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
if f.rootBucket != "" && f.rootDirectory != "" {
|
if f.rootBucket != "" && f.rootDirectory != "" {
|
||||||
// Check to see if the object exists
|
// Check to see if the object exists
|
||||||
encodedDirectory := f.opt.Enc.FromStandardPath(f.rootDirectory)
|
encodedDirectory := f.opt.Enc.FromStandardPath(f.rootDirectory)
|
||||||
|
|
|
@ -203,7 +203,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
BucketBased: opt.LibraryName == "",
|
BucketBased: opt.LibraryName == "",
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
|
|
||||||
serverInfo, err := f.getServerInfo(ctx)
|
serverInfo, err := f.getServerInfo(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -609,7 +609,7 @@ func NewFsWithConnection(ctx context.Context, f *Fs, name string, root string, m
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
SlowHash: true,
|
SlowHash: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
// Make a connection and pool it to return errors early
|
// Make a connection and pool it to return errors early
|
||||||
c, err := f.getSftpConnection()
|
c, err := f.getSftpConnection()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -452,7 +452,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
ReadMimeType: false,
|
ReadMimeType: false,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
f.srv.SetErrorHandler(errorHandler)
|
f.srv.SetErrorHandler(errorHandler)
|
||||||
f.fillBufferTokens()
|
f.fillBufferTokens()
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
f.features.Fill(&tempF)
|
f.features.Fill(ctx, &tempF)
|
||||||
// XXX: update the old f here instead of returning tempF, since
|
// XXX: update the old f here instead of returning tempF, since
|
||||||
// `features` were already filled with functions having *f as a receiver.
|
// `features` were already filled with functions having *f as a receiver.
|
||||||
// See https://github.com/rclone/rclone/issues/2182
|
// See https://github.com/rclone/rclone/issues/2182
|
||||||
|
|
|
@ -416,7 +416,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
f.srv.SetSigner(f.getAuth) // use signing hook to get the auth
|
f.srv.SetSigner(f.getAuth) // use signing hook to get the auth
|
||||||
f.srv.SetErrorHandler(errorHandler)
|
f.srv.SetErrorHandler(errorHandler)
|
||||||
|
|
||||||
|
|
|
@ -448,7 +448,7 @@ func NewFsWithConnection(ctx context.Context, opt *Options, name, root string, c
|
||||||
BucketBased: true,
|
BucketBased: true,
|
||||||
BucketBasedRootOK: true,
|
BucketBasedRootOK: true,
|
||||||
SlowModTime: true,
|
SlowModTime: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
if f.rootContainer != "" && f.rootDirectory != "" {
|
if f.rootContainer != "" && f.rootDirectory != "" {
|
||||||
// Check to see if the object exists - ignoring directory markers
|
// Check to see if the object exists - ignoring directory markers
|
||||||
var info swift.Object
|
var info swift.Object
|
||||||
|
|
|
@ -217,7 +217,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (_ fs.Fs,
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
BucketBased: true,
|
BucketBased: true,
|
||||||
BucketBasedRootOK: true,
|
BucketBasedRootOK: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
|
|
||||||
project, err := f.connect(ctx)
|
project, err := f.connect(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -833,9 +833,9 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
BucketBased: true,
|
BucketBased: true,
|
||||||
SetTier: true,
|
SetTier: true,
|
||||||
GetTier: true,
|
GetTier: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
for _, f := range upstreams {
|
for _, f := range upstreams {
|
||||||
features = features.Mask(f) // Mask all upstream fs
|
features = features.Mask(ctx, f) // Mask all upstream fs
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable ListR when upstreams either support ListR or is local
|
// Enable ListR when upstreams either support ListR or is local
|
||||||
|
|
|
@ -342,7 +342,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
}
|
}
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
if opt.User != "" || opt.Pass != "" {
|
if opt.User != "" || opt.Pass != "" {
|
||||||
f.srv.SetUserPass(opt.User, opt.Pass)
|
f.srv.SetUserPass(opt.User, opt.Pass)
|
||||||
} else if opt.BearerToken != "" {
|
} else if opt.BearerToken != "" {
|
||||||
|
|
|
@ -276,7 +276,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
ReadMimeType: true,
|
ReadMimeType: true,
|
||||||
WriteMimeType: true,
|
WriteMimeType: true,
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
}).Fill(f)
|
}).Fill(ctx, f)
|
||||||
f.srv.SetErrorHandler(errorHandler)
|
f.srv.SetErrorHandler(errorHandler)
|
||||||
|
|
||||||
// Check to see if the object exists and is a file
|
// Check to see if the object exists and is a file
|
||||||
|
|
4
fs/fs.go
4
fs/fs.go
|
@ -715,7 +715,7 @@ func (ft *Features) DisableList(list []string) *Features {
|
||||||
// Fill fills in the function pointers in the Features struct from the
|
// Fill fills in the function pointers in the Features struct from the
|
||||||
// optional interfaces. It returns the original updated Features
|
// optional interfaces. It returns the original updated Features
|
||||||
// struct passed in.
|
// struct passed in.
|
||||||
func (ft *Features) Fill(f Fs) *Features {
|
func (ft *Features) Fill(ctx context.Context, f Fs) *Features {
|
||||||
if do, ok := f.(Purger); ok {
|
if do, ok := f.(Purger); ok {
|
||||||
ft.Purge = do.Purge
|
ft.Purge = do.Purge
|
||||||
}
|
}
|
||||||
|
@ -783,7 +783,7 @@ func (ft *Features) Fill(f Fs) *Features {
|
||||||
// Fs AND the one passed in will be advertised. Any features which
|
// Fs AND the one passed in will be advertised. Any features which
|
||||||
// aren't in both will be set to false/nil, except for UnWrap/Wrap which
|
// aren't in both will be set to false/nil, except for UnWrap/Wrap which
|
||||||
// will be left untouched.
|
// will be left untouched.
|
||||||
func (ft *Features) Mask(f Fs) *Features {
|
func (ft *Features) Mask(ctx context.Context, f Fs) *Features {
|
||||||
mask := f.Features()
|
mask := f.Features()
|
||||||
ft.CaseInsensitive = ft.CaseInsensitive && mask.CaseInsensitive
|
ft.CaseInsensitive = ft.CaseInsensitive && mask.CaseInsensitive
|
||||||
ft.DuplicateFiles = ft.DuplicateFiles && mask.DuplicateFiles
|
ft.DuplicateFiles = ft.DuplicateFiles && mask.DuplicateFiles
|
||||||
|
|
|
@ -389,7 +389,7 @@ func Run(t *testing.T, opt *Opt) {
|
||||||
if opt.SkipFsCheckWrap {
|
if opt.SkipFsCheckWrap {
|
||||||
t.Skip("Skipping FsCheckWrap on this Fs")
|
t.Skip("Skipping FsCheckWrap on this Fs")
|
||||||
}
|
}
|
||||||
ft := new(fs.Features).Fill(remote)
|
ft := new(fs.Features).Fill(ctx, remote)
|
||||||
if ft.UnWrap == nil {
|
if ft.UnWrap == nil {
|
||||||
t.Skip("Not a wrapping Fs")
|
t.Skip("Not a wrapping Fs")
|
||||||
}
|
}
|
||||||
|
@ -1584,7 +1584,7 @@ func Run(t *testing.T, opt *Opt) {
|
||||||
if opt.SkipObjectCheckWrap {
|
if opt.SkipObjectCheckWrap {
|
||||||
t.Skip("Skipping FsCheckWrap on this Fs")
|
t.Skip("Skipping FsCheckWrap on this Fs")
|
||||||
}
|
}
|
||||||
ft := new(fs.Features).Fill(remote)
|
ft := new(fs.Features).Fill(ctx, remote)
|
||||||
if ft.UnWrap == nil {
|
if ft.UnWrap == nil {
|
||||||
t.Skip("Not a wrapping Fs")
|
t.Skip("Not a wrapping Fs")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue