mirror of
https://github.com/rclone/rclone.git
synced 2024-12-20 18:35:58 +08:00
d0888edc0a
Fix spelling of: above, already, anonymous, associated, authentication, bandwidth, because, between, blocks, calculate, candidates, cautious, changelog, cleaner, clipboard, command, completely, concurrently, considered, constructs, corrupt, current, daemon, dependencies, deprecated, directory, dispatcher, download, eligible, ellipsis, encrypter, endpoint, entrieslist, essentially, existing writers, existing, expires, filesystem, flushing, frequently, hierarchy, however, implementation, implements, inaccurate, individually, insensitive, longer, maximum, metadata, modified, multipart, namedirfirst, nextcloud, obscured, opened, optional, owncloud, pacific, passphrase, password, permanently, persimmon, positive, potato, protocol, quota, receiving, recommends, referring, requires, revisited, satisfied, satisfies, satisfy, semver, serialized, session, storage, strategies, stringlist, successful, supported, surprise, temporarily, temporary, transactions, unneeded, update, uploads, wrapped Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
33 lines
757 B
Go
33 lines
757 B
Go
package policy
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/rclone/rclone/backend/union/upstream"
|
|
"github.com/rclone/rclone/fs"
|
|
)
|
|
|
|
func init() {
|
|
registerPolicy("ff", &FF{})
|
|
}
|
|
|
|
// FF stands for first found
|
|
// Search category: same as epff.
|
|
// Action category: same as epff.
|
|
// Create category: Given the order of the candidates, act on the first one found.
|
|
type FF struct {
|
|
EpFF
|
|
}
|
|
|
|
// Create category policy, governing the creation of files and directories
|
|
func (p *FF) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error) {
|
|
if len(upstreams) == 0 {
|
|
return nil, fs.ErrorObjectNotFound
|
|
}
|
|
upstreams = filterNC(upstreams)
|
|
if len(upstreams) == 0 {
|
|
return upstreams, fs.ErrorPermissionDenied
|
|
}
|
|
return upstreams[:1], nil
|
|
}
|