build: reformat comments to pass go1.19 vet

See: https://go.dev/doc/go1.19#go-doc
This commit is contained in:
Nick Craig-Wood 2022-08-05 16:35:41 +01:00
parent 876f791ecd
commit 6fd9e3d717
93 changed files with 444 additions and 443 deletions

View File

@ -556,9 +556,9 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
// //
// This is a workaround for Amazon sometimes returning // This is a workaround for Amazon sometimes returning
// //
// * 408 REQUEST_TIMEOUT // - 408 REQUEST_TIMEOUT
// * 504 GATEWAY_TIMEOUT // - 504 GATEWAY_TIMEOUT
// * 500 Internal server error // - 500 Internal server error
// //
// At the end of large uploads. The speculation is that the timeout // At the end of large uploads. The speculation is that the timeout
// is waiting for the sha1 hashing to complete and the file may well // is waiting for the sha1 hashing to complete and the file may well
@ -626,7 +626,7 @@ func (f *Fs) checkUpload(ctx context.Context, resp *http.Response, in io.Reader,
// Put the object into the container // Put the object into the container
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -685,9 +685,9 @@ func (f *Fs) Mkdir(ctx context.Context, dir string) error {
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1002,7 +1002,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {

View File

@ -1115,7 +1115,7 @@ func (f *Fs) listContainersToFn(fn listContainerFn) error {
// Put the object into the container // Put the object into the container
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -1247,9 +1247,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1356,11 +1356,12 @@ func (o *Object) setMetadata(metadata azblob.Metadata) {
// decodeMetaDataFromPropertiesResponse sets the metadata from the data passed in // decodeMetaDataFromPropertiesResponse sets the metadata from the data passed in
// //
// Sets // Sets
// o.id //
// o.modTime // o.id
// o.size // o.modTime
// o.md5 // o.size
// o.meta // o.md5
// o.meta
func (o *Object) decodeMetaDataFromPropertiesResponse(info *azblob.BlobGetPropertiesResponse) (err error) { func (o *Object) decodeMetaDataFromPropertiesResponse(info *azblob.BlobGetPropertiesResponse) (err error) {
metadata := info.NewMetadata() metadata := info.NewMetadata()
size := info.ContentLength() size := info.ContentLength()
@ -1443,10 +1444,11 @@ func (o *Object) clearMetaData() {
// readMetaData gets the metadata if it hasn't already been fetched // readMetaData gets the metadata if it hasn't already been fetched
// //
// Sets // Sets
// o.id //
// o.modTime // o.id
// o.size // o.modTime
// o.md5 // o.size
// o.md5
func (o *Object) readMetaData() (err error) { func (o *Object) readMetaData() (err error) {
container, _ := o.split() container, _ := o.split()
if !o.fs.containerOK(container) { if !o.fs.containerOK(container) {

View File

@ -656,15 +656,15 @@ var errEndList = errors.New("end list")
// //
// (bucket, directory) is the starting directory // (bucket, directory) is the starting directory
// //
// If prefix is set then it is removed from all file names // If prefix is set then it is removed from all file names.
// //
// If addBucket is set then it adds the bucket to the start of the // If addBucket is set then it adds the bucket to the start of the
// remotes generated // remotes generated.
// //
// If recurse is set the function will recursively list // If recurse is set the function will recursively list.
// //
// If limit is > 0 then it limits to that many files (must be less // If limit is > 0 then it limits to that many files (must be less
// than 1000) // than 1000).
// //
// If hidden is set then it will list the hidden (deleted) files too. // If hidden is set then it will list the hidden (deleted) files too.
// //
@ -1025,7 +1025,7 @@ func (f *Fs) clearBucketID(bucket string) {
// Put the object into the bucket // Put the object into the bucket
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -1334,9 +1334,9 @@ func (f *Fs) copy(ctx context.Context, dstObj *Object, srcObj *Object, newInfo *
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1478,7 +1478,7 @@ func (o *Object) Size() int64 {
// Clean the SHA1 // Clean the SHA1
// //
// Make sure it is lower case // Make sure it is lower case.
// //
// Remove unverified prefix - see https://www.backblaze.com/b2/docs/uploading.html // Remove unverified prefix - see https://www.backblaze.com/b2/docs/uploading.html
// Some tools (e.g. Cyberduck) use this // Some tools (e.g. Cyberduck) use this
@ -1490,10 +1490,11 @@ func cleanSHA1(sha1 string) string {
// decodeMetaDataRaw sets the metadata from the data passed in // decodeMetaDataRaw sets the metadata from the data passed in
// //
// Sets // Sets
// o.id //
// o.modTime // o.id
// o.size // o.modTime
// o.sha1 // o.size
// o.sha1
func (o *Object) decodeMetaDataRaw(ID, SHA1 string, Size int64, UploadTimestamp api.Timestamp, Info map[string]string, mimeType string) (err error) { func (o *Object) decodeMetaDataRaw(ID, SHA1 string, Size int64, UploadTimestamp api.Timestamp, Info map[string]string, mimeType string) (err error) {
o.id = ID o.id = ID
o.sha1 = SHA1 o.sha1 = SHA1
@ -1512,10 +1513,11 @@ func (o *Object) decodeMetaDataRaw(ID, SHA1 string, Size int64, UploadTimestamp
// decodeMetaData sets the metadata in the object from an api.File // decodeMetaData sets the metadata in the object from an api.File
// //
// Sets // Sets
// o.id //
// o.modTime // o.id
// o.size // o.modTime
// o.sha1 // o.size
// o.sha1
func (o *Object) decodeMetaData(info *api.File) (err error) { func (o *Object) decodeMetaData(info *api.File) (err error) {
return o.decodeMetaDataRaw(info.ID, info.SHA1, info.Size, info.UploadTimestamp, info.Info, info.ContentType) return o.decodeMetaDataRaw(info.ID, info.SHA1, info.Size, info.UploadTimestamp, info.Info, info.ContentType)
} }
@ -1523,10 +1525,11 @@ func (o *Object) decodeMetaData(info *api.File) (err error) {
// decodeMetaDataFileInfo sets the metadata in the object from an api.FileInfo // decodeMetaDataFileInfo sets the metadata in the object from an api.FileInfo
// //
// Sets // Sets
// o.id //
// o.modTime // o.id
// o.size // o.modTime
// o.sha1 // o.size
// o.sha1
func (o *Object) decodeMetaDataFileInfo(info *api.FileInfo) (err error) { func (o *Object) decodeMetaDataFileInfo(info *api.FileInfo) (err error) {
return o.decodeMetaDataRaw(info.ID, info.SHA1, info.Size, info.UploadTimestamp, info.Info, info.ContentType) return o.decodeMetaDataRaw(info.ID, info.SHA1, info.Size, info.UploadTimestamp, info.Info, info.ContentType)
} }
@ -1584,10 +1587,11 @@ func (o *Object) getMetaData(ctx context.Context) (info *api.File, err error) {
// readMetaData gets the metadata if it hasn't already been fetched // readMetaData gets the metadata if it hasn't already been fetched
// //
// Sets // Sets
// o.id //
// o.modTime // o.id
// o.size // o.modTime
// o.sha1 // o.size
// o.sha1
func (o *Object) readMetaData(ctx context.Context) (err error) { func (o *Object) readMetaData(ctx context.Context) (err error) {
if o.id != "" { if o.id != "" {
return nil return nil

View File

@ -692,7 +692,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
// Creates from the parameters passed in a half finished Object which // Creates from the parameters passed in a half finished Object which
// must have setMetaData called on it // must have setMetaData called on it
// //
// Returns the object, leaf, directoryID and error // Returns the object, leaf, directoryID and error.
// //
// Used to create new objects // Used to create new objects
func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) { func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) {
@ -752,7 +752,7 @@ func (f *Fs) preUploadCheck(ctx context.Context, leaf, directoryID string, size
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -792,9 +792,9 @@ func (f *Fs) PutStream(ctx context.Context, in io.Reader, src fs.ObjectInfo, opt
// PutUnchecked the object into the container // PutUnchecked the object into the container
// //
// This will produce an error if the object already exists // This will produce an error if the object already exists.
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -877,9 +877,9 @@ func (f *Fs) Precision() time.Duration {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -995,9 +995,9 @@ func (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error) {
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1235,7 +1235,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {
@ -1346,9 +1345,9 @@ func (o *Object) upload(ctx context.Context, in io.Reader, leaf, directoryID str
// Update the object with the contents of the io.Reader, modTime and size // Update the object with the contents of the io.Reader, modTime and size
// //
// If existing is set then it updates the object rather than creating a new one // If existing is set then it updates the object rather than creating a new one.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned.
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {
if o.fs.tokenRenewer != nil { if o.fs.tokenRenewer != nil {
o.fs.tokenRenewer.Start() o.fs.tokenRenewer.Start()

View File

@ -32,7 +32,6 @@ import (
"github.com/rclone/rclone/fs/operations" "github.com/rclone/rclone/fs/operations"
) )
//
// Chunker's composite files have one or more chunks // Chunker's composite files have one or more chunks
// and optional metadata object. If it's present, // and optional metadata object. If it's present,
// meta object is named after the original file. // meta object is named after the original file.
@ -79,7 +78,6 @@ import (
// Metadata format v1 does not define any control chunk types, // Metadata format v1 does not define any control chunk types,
// they are currently ignored aka reserved. // they are currently ignored aka reserved.
// In future they can be used to implement resumable uploads etc. // In future they can be used to implement resumable uploads etc.
//
const ( const (
ctrlTypeRegStr = `[a-z][a-z0-9]{2,6}` ctrlTypeRegStr = `[a-z][a-z0-9]{2,6}`
tempSuffixFormat = `_%04s` tempSuffixFormat = `_%04s`
@ -542,7 +540,6 @@ func (f *Fs) setChunkNameFormat(pattern string) error {
// //
// xactID is a transaction identifier. Empty xactID denotes active chunk, // xactID is a transaction identifier. Empty xactID denotes active chunk,
// otherwise temporary chunk name is produced. // otherwise temporary chunk name is produced.
//
func (f *Fs) makeChunkName(filePath string, chunkNo int, ctrlType, xactID string) string { func (f *Fs) makeChunkName(filePath string, chunkNo int, ctrlType, xactID string) string {
dir, parentName := path.Split(filePath) dir, parentName := path.Split(filePath)
var name, tempSuffix string var name, tempSuffix string
@ -708,7 +705,6 @@ func (f *Fs) newXactID(ctx context.Context, filePath string) (xactID string, err
// directory together with dead chunks. // directory together with dead chunks.
// In future a flag named like `--chunker-list-hidden` may be added to // In future a flag named like `--chunker-list-hidden` may be added to
// rclone that will tell List to reveal hidden chunks. // rclone that will tell List to reveal hidden chunks.
//
func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) { func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) {
entries, err = f.base.List(ctx, dir) entries, err = f.base.List(ctx, dir)
if err != nil { if err != nil {
@ -868,7 +864,6 @@ func (f *Fs) processEntries(ctx context.Context, origEntries fs.DirEntries, dirP
// Note that chunker prefers analyzing file names rather than reading // Note that chunker prefers analyzing file names rather than reading
// the content of meta object assuming that directory scans are fast // the content of meta object assuming that directory scans are fast
// but opening even a small file can be slow on some backends. // but opening even a small file can be slow on some backends.
//
func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) { func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
return f.scanObject(ctx, remote, false) return f.scanObject(ctx, remote, false)
} }
@ -1586,7 +1581,6 @@ func (f *Fs) Rmdir(ctx context.Context, dir string) error {
// This command will chain to `purge` from wrapped remote. // This command will chain to `purge` from wrapped remote.
// As a result it removes not only composite chunker files with their // As a result it removes not only composite chunker files with their
// active chunks but also all hidden temporary chunks in the directory. // active chunks but also all hidden temporary chunks in the directory.
//
func (f *Fs) Purge(ctx context.Context, dir string) error { func (f *Fs) Purge(ctx context.Context, dir string) error {
do := f.base.Features().Purge do := f.base.Features().Purge
if do == nil { if do == nil {
@ -1628,7 +1622,6 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
// Unsupported control chunks will get re-picked by a more recent // Unsupported control chunks will get re-picked by a more recent
// rclone version with unexpected results. This can be helped by // rclone version with unexpected results. This can be helped by
// the `delete hidden` flag above or at least the user has been warned. // the `delete hidden` flag above or at least the user has been warned.
//
func (o *Object) Remove(ctx context.Context) (err error) { func (o *Object) Remove(ctx context.Context) (err error) {
if err := o.f.forbidChunk(o, o.Remote()); err != nil { if err := o.f.forbidChunk(o, o.Remote()); err != nil {
// operations.Move can still call Remove if chunker's Move refuses // operations.Move can still call Remove if chunker's Move refuses
@ -1804,9 +1797,9 @@ func (f *Fs) okForServerSide(ctx context.Context, src fs.Object, opName string)
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1825,9 +1818,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -2125,7 +2118,6 @@ func (o *Object) SetModTime(ctx context.Context, mtime time.Time) error {
// file, then tries to read it from metadata. This in theory // file, then tries to read it from metadata. This in theory
// handles the unusual case when a small file has been tampered // handles the unusual case when a small file has been tampered
// on the level of wrapped remote but chunker is unaware of that. // on the level of wrapped remote but chunker is unaware of that.
//
func (o *Object) Hash(ctx context.Context, hashType hash.Type) (string, error) { func (o *Object) Hash(ctx context.Context, hashType hash.Type) (string, error) {
if err := o.readMetadata(ctx); err != nil { if err := o.readMetadata(ctx); err != nil {
return "", err // valid metadata is required to get hash, abort return "", err // valid metadata is required to get hash, abort
@ -2414,7 +2406,6 @@ type metaSimpleJSON struct {
// - for files larger than chunk size // - for files larger than chunk size
// - if file contents can be mistaken as meta object // - if file contents can be mistaken as meta object
// - if consistent hashing is On but wrapped remote can't provide given hash // - if consistent hashing is On but wrapped remote can't provide given hash
//
func marshalSimpleJSON(ctx context.Context, size int64, nChunks int, md5, sha1, xactID string) ([]byte, error) { func marshalSimpleJSON(ctx context.Context, size int64, nChunks int, md5, sha1, xactID string) ([]byte, error) {
version := metadataVersion version := metadataVersion
if xactID == "" && version == 2 { if xactID == "" && version == 2 {
@ -2447,7 +2438,6 @@ func marshalSimpleJSON(ctx context.Context, size int64, nChunks int, md5, sha1,
// New format will have a higher version number and cannot be correctly // New format will have a higher version number and cannot be correctly
// handled by current implementation. // handled by current implementation.
// The version check below will then explicitly ask user to upgrade rclone. // The version check below will then explicitly ask user to upgrade rclone.
//
func unmarshalSimpleJSON(ctx context.Context, metaObject fs.Object, data []byte) (info *ObjectInfo, madeByChunker bool, err error) { func unmarshalSimpleJSON(ctx context.Context, metaObject fs.Object, data []byte) (info *ObjectInfo, madeByChunker bool, err error) {
// Be strict about JSON format // Be strict about JSON format
// to reduce possibility that a random small file resembles metadata. // to reduce possibility that a random small file resembles metadata.

View File

@ -457,9 +457,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -491,9 +491,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -785,9 +785,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
// Copy src to this remote using server side copy operations. // Copy src to this remote using server side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -835,9 +835,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
// Move src to this remote using server side move operations. // Move src to this remote using server side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -127,8 +127,8 @@ type fileNameEncoding interface {
// RFC4648 // RFC4648
// //
// The standard encoding is modified in two ways // The standard encoding is modified in two ways
// * it becomes lower case (no-one likes upper case filenames!) // - it becomes lower case (no-one likes upper case filenames!)
// * we strip the padding character `=` // - we strip the padding character `=`
type caseInsensitiveBase32Encoding struct{} type caseInsensitiveBase32Encoding struct{}
// EncodeToString encodes a strign using the modified version of // EncodeToString encodes a strign using the modified version of
@ -244,7 +244,7 @@ func (c *Cipher) putBlock(buf []byte) {
// encryptSegment encrypts a path segment // encryptSegment encrypts a path segment
// //
// This uses EME with AES // This uses EME with AES.
// //
// EME (ECB-Mix-ECB) is a wide-block encryption mode presented in the // EME (ECB-Mix-ECB) is a wide-block encryption mode presented in the
// 2003 paper "A Parallelizable Enciphering Mode" by Halevi and // 2003 paper "A Parallelizable Enciphering Mode" by Halevi and
@ -254,8 +254,8 @@ func (c *Cipher) putBlock(buf []byte) {
// same filename must encrypt to the same thing. // same filename must encrypt to the same thing.
// //
// This means that // This means that
// * filenames with the same name will encrypt the same // - filenames with the same name will encrypt the same
// * filenames which start the same won't have a common prefix // - filenames which start the same won't have a common prefix
func (c *Cipher) encryptSegment(plaintext string) string { func (c *Cipher) encryptSegment(plaintext string) string {
if plaintext == "" { if plaintext == "" {
return "" return ""
@ -1085,7 +1085,7 @@ func (c *Cipher) DecryptData(rc io.ReadCloser) (io.ReadCloser, error) {
// DecryptDataSeek decrypts the data stream from offset // DecryptDataSeek decrypts the data stream from offset
// //
// The open function must return a ReadCloser opened to the offset supplied // The open function must return a ReadCloser opened to the offset supplied.
// //
// You must use this form of DecryptData if you might want to Seek the file handle // You must use this form of DecryptData if you might want to Seek the file handle
func (c *Cipher) DecryptDataSeek(ctx context.Context, open OpenRangeSeek, offset, limit int64) (ReadSeekCloser, error) { func (c *Cipher) DecryptDataSeek(ctx context.Context, open OpenRangeSeek, offset, limit int64) (ReadSeekCloser, error) {

View File

@ -507,9 +507,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -532,9 +532,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -2180,7 +2180,7 @@ func (f *Fs) createFileInfo(ctx context.Context, remote string, modTime time.Tim
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -2414,9 +2414,9 @@ func (f *Fs) Precision() time.Duration {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -2649,9 +2649,9 @@ func (f *Fs) About(ctx context.Context) (*fs.Usage, error) {
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -3569,7 +3569,6 @@ func (f *Fs) getRemoteInfoWithExport(ctx context.Context, remote string) (
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *baseObject) ModTime(ctx context.Context) time.Time { func (o *baseObject) ModTime(ctx context.Context) time.Time {
@ -3826,7 +3825,7 @@ func (o *baseObject) update(ctx context.Context, updateInfo *drive.File, uploadM
// Update the already existing object // Update the already existing object
// //
// Copy the reader into the object updating modTime and size // Copy the reader into the object updating modTime and size.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error {

View File

@ -925,7 +925,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -1044,9 +1044,9 @@ func (f *Fs) Precision() time.Duration {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1105,9 +1105,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) (err error) {
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1763,7 +1763,7 @@ func checkPathLength(name string) (err error) {
// Update the already existing object // Update the already existing object
// //
// Copy the reader into the object updating modTime and size // Copy the reader into the object updating modTime and size.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error {

View File

@ -373,7 +373,7 @@ type params map[string]interface{}
// rpc calls the rpc.php method of the SME file fabric // rpc calls the rpc.php method of the SME file fabric
// //
// This is an entry point to all the method calls // This is an entry point to all the method calls.
// //
// If result is nil then resp.Body will need closing // If result is nil then resp.Body will need closing
func (f *Fs) rpc(ctx context.Context, function string, p params, result api.OKError, options []fs.OpenOption) (resp *http.Response, err error) { func (f *Fs) rpc(ctx context.Context, function string, p params, result api.OKError, options []fs.OpenOption) (resp *http.Response, err error) {
@ -678,7 +678,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
// Creates from the parameters passed in a half finished Object which // Creates from the parameters passed in a half finished Object which
// must have setMetaData called on it // must have setMetaData called on it
// //
// Returns the object, leaf, directoryID and error // Returns the object, leaf, directoryID and error.
// //
// Used to create new objects // Used to create new objects
func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) { func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) {
@ -697,7 +697,7 @@ func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time,
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -783,9 +783,9 @@ func (f *Fs) Precision() time.Duration {
// Copy src to this remote using server side copy operations. // Copy src to this remote using server side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -956,9 +956,9 @@ func (f *Fs) move(ctx context.Context, isDir bool, id, oldLeaf, newLeaf, oldDire
// Move src to this remote using server side move operations. // Move src to this remote using server side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1135,7 +1135,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {
@ -1201,7 +1200,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
// Update the object with the contents of the io.Reader, modTime and size // Update the object with the contents of the io.Reader, modTime and size
// //
// If existing is set then it updates the object rather than creating a new one // If existing is set then it updates the object rather than creating a new one.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {

View File

@ -769,11 +769,12 @@ func (f *Fs) Hashes() hash.Set {
// Precision shows whether modified time is supported or not depending on the // Precision shows whether modified time is supported or not depending on the
// FTP server capabilities, namely whether FTP server: // FTP server capabilities, namely whether FTP server:
// - accepts the MDTM command to get file time (fGetTime) // - accepts the MDTM command to get file time (fGetTime)
// or supports MLSD returning precise file time in the list (fLstTime) // or supports MLSD returning precise file time in the list (fLstTime)
// - accepts the MFMT command to set file time (fSetTime) // - accepts the MFMT command to set file time (fSetTime)
// or non-standard form of the MDTM command (fSetTime, too) // or non-standard form of the MDTM command (fSetTime, too)
// used by VsFtpd for the same purpose (WritingMDTM) // used by VsFtpd for the same purpose (WritingMDTM)
//
// See "mdtm_write" in https://security.appspot.com/vsftpd/vsftpd_conf.html // See "mdtm_write" in https://security.appspot.com/vsftpd/vsftpd_conf.html
func (f *Fs) Precision() time.Duration { func (f *Fs) Precision() time.Duration {
if (f.fGetTime || f.fLstTime) && f.fSetTime { if (f.fGetTime || f.fLstTime) && f.fSetTime {
@ -1149,7 +1150,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (rc io.Read
// Update the already existing object // Update the already existing object
// //
// Copy the reader into the object updating modTime and size // Copy the reader into the object updating modTime and size.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {

View File

@ -580,7 +580,7 @@ type listFn func(remote string, object *storage.Object, isDirectory bool) error
// //
// dir is the starting directory, "" for root // dir is the starting directory, "" for root
// //
// Set recurse to read sub directories // Set recurse to read sub directories.
// //
// The remote has prefix removed from it and if addBucket is set // The remote has prefix removed from it and if addBucket is set
// then it adds the bucket to the start. // then it adds the bucket to the start.
@ -798,7 +798,7 @@ func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) (
// Put the object into the bucket // Put the object into the bucket
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -900,9 +900,9 @@ func (f *Fs) Precision() time.Duration {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -661,7 +661,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
// Put the object into the bucket // Put the object into the bucket
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {

View File

@ -315,7 +315,7 @@ func yearMonthDayFilter(ctx context.Context, f lister, match []string) (sf api.S
// featureFilter creates a filter for the Feature enum // featureFilter creates a filter for the Feature enum
// //
// The API only supports one feature, FAVORITES, so hardcode that feature // The API only supports one feature, FAVORITES, so hardcode that feature.
// //
// https://developers.google.com/photos/library/reference/rest/v1/mediaItems/search#FeatureFilter // https://developers.google.com/photos/library/reference/rest/v1/mediaItems/search#FeatureFilter
func featureFilter(ctx context.Context, f lister, match []string) (sf api.SearchFilter) { func featureFilter(ctx context.Context, f lister, match []string) (sf api.SearchFilter) {

View File

@ -265,9 +265,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -577,9 +577,9 @@ func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration,
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -1247,7 +1247,7 @@ func (f *Fs) createObject(remote string, modTime time.Time, size int64) (o *Obje
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -1397,9 +1397,9 @@ func (f *Fs) copyOrMove(ctx context.Context, method, src, dest string) (info *ap
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1433,9 +1433,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1829,7 +1829,7 @@ func readMD5(in io.Reader, size, threshold int64) (md5sum string, out io.Reader,
// Update the object with the contents of the io.Reader, modTime and size // Update the object with the contents of the io.Reader, modTime and size
// //
// If existing is set then it updates the object rather than creating a new one // If existing is set then it updates the object rather than creating a new one.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {

View File

@ -695,9 +695,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -5,8 +5,8 @@ package local
import ( import (
"os" "os"
"time"
"syscall" "syscall"
"time"
) )
const haveSetBTime = true const haveSetBTime = true

View File

@ -630,9 +630,10 @@ func (f *Fs) readItemMetaData(ctx context.Context, path string) (entry fs.DirEnt
// itemToEntry converts API item to rclone directory entry // itemToEntry converts API item to rclone directory entry
// The dirSize return value is: // The dirSize return value is:
// <0 - for a file or in case of error //
// =0 - for an empty directory // <0 - for a file or in case of error
// >0 - for a non-empty directory // =0 - for an empty directory
// >0 - for a non-empty directory
func (f *Fs) itemToDirEntry(ctx context.Context, item *api.ListItem) (entry fs.DirEntry, dirSize int, err error) { func (f *Fs) itemToDirEntry(ctx context.Context, item *api.ListItem) (entry fs.DirEntry, dirSize int, err error) {
remote, err := f.relPath(f.opt.Enc.ToStandardPath(item.Home)) remote, err := f.relPath(f.opt.Enc.ToStandardPath(item.Home))
if err != nil { if err != nil {

View File

@ -118,7 +118,7 @@ type Fs struct {
// Object describes a mega object // Object describes a mega object
// //
// Will definitely have info but maybe not meta // Will definitely have info but maybe not meta.
// //
// Normally rclone would just store an ID here but go-mega and mega.nz // Normally rclone would just store an ID here but go-mega and mega.nz
// expect you to build an entire tree of all the objects in memory. // expect you to build an entire tree of all the objects in memory.
@ -536,7 +536,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
// Creates from the parameters passed in a half finished Object which // Creates from the parameters passed in a half finished Object which
// must have setMetaData called on it // must have setMetaData called on it
// //
// Returns the dirNode, object, leaf and error // Returns the dirNode, object, leaf and error.
// //
// Used to create new objects // Used to create new objects
func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, dirNode *mega.Node, leaf string, err error) { func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, dirNode *mega.Node, leaf string, err error) {
@ -554,7 +554,7 @@ func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time,
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
// PutUnchecked uploads the object // PutUnchecked uploads the object
@ -576,7 +576,7 @@ func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options .
// PutUnchecked the object // PutUnchecked the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
// PutUnchecked uploads the object // PutUnchecked uploads the object
@ -749,9 +749,9 @@ func (f *Fs) move(ctx context.Context, dstRemote string, srcFs *Fs, srcRemote st
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -979,7 +979,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {
@ -1115,7 +1114,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
// Update the object with the contents of the io.Reader, modTime and size // Update the object with the contents of the io.Reader, modTime and size
// //
// If existing is set then it updates the object rather than creating a new one // If existing is set then it updates the object rather than creating a new one.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {

View File

@ -418,7 +418,7 @@ func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) (
// Put the object into the bucket // Put the object into the bucket
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -463,9 +463,9 @@ func (f *Fs) Precision() time.Duration {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -250,8 +250,8 @@ type MoveItemRequest struct {
FileSystemInfo *FileSystemInfoFacet `json:"fileSystemInfo,omitempty"` // File system information on client. Read-write. FileSystemInfo *FileSystemInfoFacet `json:"fileSystemInfo,omitempty"` // File system information on client. Read-write.
} }
//CreateShareLinkRequest is the request to create a sharing link // CreateShareLinkRequest is the request to create a sharing link
//Always Type:view and Scope:anonymous for public sharing // Always Type:view and Scope:anonymous for public sharing
type CreateShareLinkRequest struct { type CreateShareLinkRequest struct {
Type string `json:"type"` // Link type in View, Edit or Embed Type string `json:"type"` // Link type in View, Edit or Embed
Scope string `json:"scope,omitempty"` // Scope in anonymous, organization Scope string `json:"scope,omitempty"` // Scope in anonymous, organization
@ -259,7 +259,7 @@ type CreateShareLinkRequest struct {
Expiry *time.Time `json:"expirationDateTime,omitempty"` // A String with format of yyyy-MM-ddTHH:mm:ssZ of DateTime indicates the expiration time of the permission. Expiry *time.Time `json:"expirationDateTime,omitempty"` // A String with format of yyyy-MM-ddTHH:mm:ssZ of DateTime indicates the expiration time of the permission.
} }
//CreateShareLinkResponse is the response from CreateShareLinkRequest // CreateShareLinkResponse is the response from CreateShareLinkRequest
type CreateShareLinkResponse struct { type CreateShareLinkResponse struct {
ID string `json:"id"` ID string `json:"id"`
Roles []string `json:"roles"` Roles []string `json:"roles"`

View File

@ -727,7 +727,7 @@ func shouldRetry(ctx context.Context, resp *http.Response, err error) (bool, err
// "shared with me" folders in OneDrive Personal (See #2536, #2778) // "shared with me" folders in OneDrive Personal (See #2536, #2778)
// This path pattern comes from https://github.com/OneDrive/onedrive-api-docs/issues/908#issuecomment-417488480 // This path pattern comes from https://github.com/OneDrive/onedrive-api-docs/issues/908#issuecomment-417488480
// //
// If `relPath` == '', do not append the slash (See #3664) // If `relPath` == , do not append the slash (See #3664)
func (f *Fs) readMetaDataForPathRelativeToID(ctx context.Context, normalizedID string, relPath string) (info *api.Item, resp *http.Response, err error) { func (f *Fs) readMetaDataForPathRelativeToID(ctx context.Context, normalizedID string, relPath string) (info *api.Item, resp *http.Response, err error) {
opts, _ := f.newOptsCallWithIDPath(normalizedID, relPath, true, "GET", "") opts, _ := f.newOptsCallWithIDPath(normalizedID, relPath, true, "GET", "")
@ -1137,7 +1137,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
// Creates from the parameters passed in a half finished Object which // Creates from the parameters passed in a half finished Object which
// must have setMetaData called on it // must have setMetaData called on it
// //
// Returns the object, leaf, directoryID and error // Returns the object, leaf, directoryID and error.
// //
// Used to create new objects // Used to create new objects
func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) { func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) {
@ -1156,7 +1156,7 @@ func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time,
// Put the object into the container // Put the object into the container
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -1280,9 +1280,9 @@ func (f *Fs) waitForJob(ctx context.Context, location string, o *Object) error {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1387,9 +1387,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1843,7 +1843,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {

View File

@ -340,9 +340,9 @@ func (f *Fs) Precision() time.Duration {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -404,9 +404,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -562,7 +562,7 @@ func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
// Creates from the parameters passed in a half finished Object which // Creates from the parameters passed in a half finished Object which
// must have setMetaData called on it // must have setMetaData called on it
// //
// Returns the object, leaf, directoryID and error // Returns the object, leaf, directoryID and error.
// //
// Used to create new objects // Used to create new objects
func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) { func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) {
@ -599,7 +599,7 @@ func (f *Fs) readMetaDataForFolderID(ctx context.Context, id string) (info *Fold
// Put the object into the bucket // Put the object into the bucket
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -829,7 +829,6 @@ func (o *Object) Size() int64 {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {

View File

@ -588,7 +588,7 @@ func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) (
// Creates from the parameters passed in a half finished Object which // Creates from the parameters passed in a half finished Object which
// must have setMetaData called on it // must have setMetaData called on it
// //
// Returns the object, leaf, directoryID and error // Returns the object, leaf, directoryID and error.
// //
// Used to create new objects // Used to create new objects
func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) { func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) {
@ -607,7 +607,7 @@ func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time,
// Put the object into the container // Put the object into the container
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -681,9 +681,9 @@ func (f *Fs) Precision() time.Duration {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -766,9 +766,9 @@ func (f *Fs) CleanUp(ctx context.Context) error {
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1073,7 +1073,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {
@ -1152,7 +1151,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
// Update the object with the contents of the io.Reader, modTime and size // Update the object with the contents of the io.Reader, modTime and size
// //
// If existing is set then it updates the object rather than creating a new one // If existing is set then it updates the object rather than creating a new one.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {

View File

@ -493,7 +493,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
// Creates from the parameters passed in a half finished Object which // Creates from the parameters passed in a half finished Object which
// must have setMetaData called on it // must have setMetaData called on it
// //
// Returns the object, leaf, directoryID and error // Returns the object, leaf, directoryID and error.
// //
// Used to create new objects // Used to create new objects
func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) { func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) {
@ -512,7 +512,7 @@ func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time,
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -530,9 +530,9 @@ func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options .
// PutUnchecked the object into the container // PutUnchecked the object into the container
// //
// This will produce an error if the object already exists // This will produce an error if the object already exists.
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -694,9 +694,9 @@ func (f *Fs) move(ctx context.Context, isFile bool, id, oldLeaf, newLeaf, oldDir
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -870,7 +870,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {
@ -917,7 +916,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
// Update the object with the contents of the io.Reader, modTime and size // Update the object with the contents of the io.Reader, modTime and size
// //
// If existing is set then it updates the object rather than creating a new one // If existing is set then it updates the object rather than creating a new one.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {

View File

@ -230,7 +230,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (o fs.Object, err error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (o fs.Object, err error) {
@ -523,9 +523,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) (err error) {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -562,9 +562,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (o fs.Objec
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -261,7 +261,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
// Update the already existing object // Update the already existing object
// //
// Copy the reader into the object updating modTime and size // Copy the reader into the object updating modTime and size.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {

View File

@ -431,9 +431,9 @@ func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options .
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -477,7 +477,7 @@ func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
// Return an Object from a path // Return an Object from a path
// //
//If it can't be found it returns the error ErrorObjectNotFound. // If it can't be found it returns the error ErrorObjectNotFound.
func (f *Fs) newObjectWithInfo(remote string, info *qs.KeyType) (fs.Object, error) { func (f *Fs) newObjectWithInfo(remote string, info *qs.KeyType) (fs.Object, error) {
o := &Object{ o := &Object{
fs: f, fs: f,

View File

@ -2179,7 +2179,7 @@ var retryErrorCodes = []int{
503, // Service Unavailable/Slow Down - "Reduce your request rate" 503, // Service Unavailable/Slow Down - "Reduce your request rate"
} }
//S3 is pretty resilient, and the built in retry handling is probably sufficient // S3 is pretty resilient, and the built in retry handling is probably sufficient
// as it should notice closed connections and timeouts which are the most likely // as it should notice closed connections and timeouts which are the most likely
// sort of failure modes // sort of failure modes
func (f *Fs) shouldRetry(ctx context.Context, err error) (bool, error) { func (f *Fs) shouldRetry(ctx context.Context, err error) (bool, error) {
@ -2671,7 +2671,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
// Return an Object from a path // Return an Object from a path
// //
//If it can't be found it returns the error ErrorObjectNotFound. // If it can't be found it returns the error ErrorObjectNotFound.
func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *s3.Object) (fs.Object, error) { func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *s3.Object) (fs.Object, error) {
o := &Object{ o := &Object{
fs: f, fs: f,
@ -3336,9 +3336,9 @@ func (f *Fs) copyMultipart(ctx context.Context, copyReq *s3.CopyObjectInput, dst
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -671,9 +671,9 @@ func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) e
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// If it isn't possible then return fs.ErrorCantCopy // If it isn't possible then return fs.ErrorCantCopy
func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, error) { func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, error) {
@ -722,9 +722,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// If it isn't possible then return fs.ErrorCantMove // If it isn't possible then return fs.ErrorCantMove
func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object, error) { func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object, error) {

View File

@ -741,7 +741,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
// Creates from the parameters passed in a half finished Object which // Creates from the parameters passed in a half finished Object which
// must have setMetaData called on it // must have setMetaData called on it
// //
// Returns the object, leaf, directoryID and error // Returns the object, leaf, directoryID and error.
// //
// Used to create new objects // Used to create new objects
func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) { func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) {
@ -760,7 +760,7 @@ func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time,
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -783,9 +783,9 @@ func (f *Fs) PutStream(ctx context.Context, in io.Reader, src fs.ObjectInfo, opt
// PutUnchecked the object into the container // PutUnchecked the object into the container
// //
// This will produce an error if the object already exists // This will produce an error if the object already exists.
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -973,9 +973,9 @@ func (f *Fs) move(ctx context.Context, isFile bool, id, oldLeaf, newLeaf, oldDir
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1043,9 +1043,9 @@ func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1256,7 +1256,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {
@ -1324,7 +1323,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
// Update the object with the contents of the io.Reader, modTime and size // Update the object with the contents of the io.Reader, modTime and size
// //
// If existing is set then it updates the object rather than creating a new one // If existing is set then it updates the object rather than creating a new one.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {

View File

@ -683,9 +683,9 @@ func newPrefix(prefix string) string {
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -713,7 +713,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
// Creates from the parameters passed in a half finished Object which // Creates from the parameters passed in a half finished Object which
// must have setMetaData called on it // must have setMetaData called on it
// //
// Returns the object, leaf, directoryID and error // Returns the object, leaf, directoryID and error.
// //
// Used to create new objects // Used to create new objects
func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) { func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time, size int64) (o *Object, leaf string, directoryID string, err error) {
@ -732,7 +732,7 @@ func (f *Fs) createObject(ctx context.Context, remote string, modTime time.Time,
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -755,9 +755,9 @@ func (f *Fs) PutStream(ctx context.Context, in io.Reader, src fs.ObjectInfo, opt
// PutUnchecked the object into the container // PutUnchecked the object into the container
// //
// This will produce an error if the object already exists // This will produce an error if the object already exists.
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -852,9 +852,9 @@ func (f *Fs) Precision() time.Duration {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -985,9 +985,9 @@ func (f *Fs) moveDir(ctx context.Context, id, leaf, directoryID string) (err err
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1156,7 +1156,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {
@ -1229,7 +1228,7 @@ func (f *Fs) createFile(ctx context.Context, pathID, leaf, mimeType string) (new
// Update the object with the contents of the io.Reader, modTime and size // Update the object with the contents of the io.Reader, modTime and size
// //
// If existing is set then it updates the object rather than creating a new one // If existing is set then it updates the object rather than creating a new one.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {

View File

@ -790,7 +790,7 @@ func (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error) {
// Put the object into the container // Put the object into the container
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -902,9 +902,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1019,7 +1019,7 @@ func copyLargeObject(ctx context.Context, f *Fs, src *Object, dstContainer strin
return err return err
} }
//remove copied segments when copy process failed // remove copied segments when copy process failed
func handleCopyFail(ctx context.Context, f *Fs, segmentsContainer string, segments []string, err error) { func handleCopyFail(ctx context.Context, f *Fs, segmentsContainer string, segments []string, err error) {
fs.Debugf(f, "handle copy segment fail") fs.Debugf(f, "handle copy segment fail")
if err == nil { if err == nil {
@ -1140,10 +1140,11 @@ func (o *Object) Size() int64 {
// decodeMetaData sets the metadata in the object from a swift.Object // decodeMetaData sets the metadata in the object from a swift.Object
// //
// Sets // Sets
// o.lastModified //
// o.size // o.lastModified
// o.md5 // o.size
// o.contentType // o.md5
// o.contentType
func (o *Object) decodeMetaData(info *swift.Object) (err error) { func (o *Object) decodeMetaData(info *swift.Object) (err error) {
o.lastModified = info.LastModified o.lastModified = info.LastModified
o.size = info.Bytes o.size = info.Bytes
@ -1184,7 +1185,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {

View File

@ -213,9 +213,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -253,9 +253,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //

View File

@ -991,7 +991,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
// Update the already existing object // Update the already existing object
// //
// Copy the reader into the object updating modTime and size // Copy the reader into the object updating modTime and size.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error {

View File

@ -37,27 +37,29 @@ type Response struct {
// This is a lazy way of decoding the multiple <s:propstat> in the // This is a lazy way of decoding the multiple <s:propstat> in the
// response. // response.
// //
// The response might look like this // The response might look like this.
// //
// <d:response> // <d:response>
// <d:href>/remote.php/webdav/Nextcloud%20Manual.pdf</d:href> //
// <d:propstat> // <d:href>/remote.php/webdav/Nextcloud%20Manual.pdf</d:href>
// <d:prop> // <d:propstat>
// <d:getlastmodified>Tue, 19 Dec 2017 22:02:36 GMT</d:getlastmodified> // <d:prop>
// <d:getcontentlength>4143665</d:getcontentlength> // <d:getlastmodified>Tue, 19 Dec 2017 22:02:36 GMT</d:getlastmodified>
// <d:resourcetype/> // <d:getcontentlength>4143665</d:getcontentlength>
// <d:getetag>"048d7be4437ff7deeae94db50ff3e209"</d:getetag> // <d:resourcetype/>
// <d:getcontenttype>application/pdf</d:getcontenttype> // <d:getetag>"048d7be4437ff7deeae94db50ff3e209"</d:getetag>
// </d:prop> // <d:getcontenttype>application/pdf</d:getcontenttype>
// <d:status>HTTP/1.1 200 OK</d:status> // </d:prop>
// </d:propstat> // <d:status>HTTP/1.1 200 OK</d:status>
// <d:propstat> // </d:propstat>
// <d:prop> // <d:propstat>
// <d:quota-used-bytes/> // <d:prop>
// <d:quota-available-bytes/> // <d:quota-used-bytes/>
// </d:prop> // <d:quota-available-bytes/>
// <d:status>HTTP/1.1 404 Not Found</d:status> // </d:prop>
// </d:propstat> // <d:status>HTTP/1.1 404 Not Found</d:status>
// </d:propstat>
//
// </d:response> // </d:response>
// //
// So we elide the array of <d:propstat> and within that the array of // So we elide the array of <d:propstat> and within that the array of
@ -127,8 +129,10 @@ type PropValue struct {
// Error is used to describe webdav errors // Error is used to describe webdav errors
// //
// <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> // <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
// <s:exception>Sabre\DAV\Exception\NotFound</s:exception> //
// <s:message>File with name Photo could not be located</s:message> // <s:exception>Sabre\DAV\Exception\NotFound</s:exception>
// <s:message>File with name Photo could not be located</s:message>
//
// </d:error> // </d:error>
type Error struct { type Error struct {
Exception string `xml:"exception,omitempty"` Exception string `xml:"exception,omitempty"`
@ -214,16 +218,18 @@ func (t *Time) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// Quota is used to read the bytes used and available // Quota is used to read the bytes used and available
// //
// <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"> // <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
// <d:response> //
// <d:href>/remote.php/webdav/</d:href> // <d:response>
// <d:propstat> // <d:href>/remote.php/webdav/</d:href>
// <d:prop> // <d:propstat>
// <d:quota-available-bytes>-3</d:quota-available-bytes> // <d:prop>
// <d:quota-used-bytes>376461895</d:quota-used-bytes> // <d:quota-available-bytes>-3</d:quota-available-bytes>
// </d:prop> // <d:quota-used-bytes>376461895</d:quota-used-bytes>
// <d:status>HTTP/1.1 200 OK</d:status> // </d:prop>
// </d:propstat> // <d:status>HTTP/1.1 200 OK</d:status>
// </d:response> // </d:propstat>
// </d:response>
//
// </d:multistatus> // </d:multistatus>
type Quota struct { type Quota struct {
Available string `xml:"DAV: response>propstat>prop>quota-available-bytes"` Available string `xml:"DAV: response>propstat>prop>quota-available-bytes"`

View File

@ -800,7 +800,7 @@ func (f *Fs) createObject(remote string, modTime time.Time, size int64) (o *Obje
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -975,9 +975,9 @@ func (f *Fs) Precision() time.Duration {
// Copy or Move src to this remote using server-side copy operations. // Copy or Move src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1029,9 +1029,9 @@ func (f *Fs) copyOrMove(ctx context.Context, src fs.Object, remote string, metho
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1051,9 +1051,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1291,7 +1291,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
// Update the object with the contents of the io.Reader, modTime and size // Update the object with the contents of the io.Reader, modTime and size
// //
// If existing is set then it updates the object rather than creating a new one // If existing is set then it updates the object rather than creating a new one.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {

View File

@ -20,7 +20,7 @@ type ResourceInfoRequestOptions struct {
Fields []string Fields []string
} }
//ResourceInfoResponse struct is returned by the API for metadata requests. // ResourceInfoResponse struct is returned by the API for metadata requests.
type ResourceInfoResponse struct { type ResourceInfoResponse struct {
PublicKey string `json:"public_key"` PublicKey string `json:"public_key"`
Name string `json:"name"` Name string `json:"name"`
@ -61,7 +61,7 @@ type AsyncStatus struct {
Status string `json:"status"` Status string `json:"status"`
} }
//CustomPropertyResponse struct we send and is returned by the API for CustomProperty request. // CustomPropertyResponse struct we send and is returned by the API for CustomProperty request.
type CustomPropertyResponse struct { type CustomPropertyResponse struct {
CustomProperties map[string]interface{} `json:"custom_properties"` CustomProperties map[string]interface{} `json:"custom_properties"`
} }

View File

@ -30,7 +30,7 @@ import (
"golang.org/x/oauth2" "golang.org/x/oauth2"
) )
//oAuth // oAuth
const ( const (
rcloneClientID = "ac39b43b9eba4cae8ffb788c06d816a8" rcloneClientID = "ac39b43b9eba4cae8ffb788c06d816a8"
rcloneEncryptedClientSecret = "EfyyNZ3YUEwXM5yAhi72G9YwKn2mkFrYwJNS7cY0TJAhFlX9K-uJFbGlpO-RYjrJ" rcloneEncryptedClientSecret = "EfyyNZ3YUEwXM5yAhi72G9YwKn2mkFrYwJNS7cY0TJAhFlX9K-uJFbGlpO-RYjrJ"
@ -442,7 +442,7 @@ func (f *Fs) createObject(remote string, modTime time.Time, size int64) (o *Obje
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -693,9 +693,9 @@ func (f *Fs) copyOrMove(ctx context.Context, method, src, dst string, overwrite
// Copy src to this remote using server-side copy operations. // Copy src to this remote using server-side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -723,9 +723,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
// Move src to this remote using server-side move operations. // Move src to this remote using server-side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1109,7 +1109,7 @@ func (o *Object) upload(ctx context.Context, in io.Reader, overwrite bool, mimeT
// Update the already existing object // Update the already existing object
// //
// Copy the reader into the object updating modTime and size // Copy the reader into the object updating modTime and size.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error {

View File

@ -644,7 +644,7 @@ func (f *Fs) createObject(ctx context.Context, remote string, size int64, modTim
// Put the object // Put the object
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -714,9 +714,9 @@ func (f *Fs) upload(ctx context.Context, name string, parent string, size int64,
// PutUnchecked the object into the container // PutUnchecked the object into the container
// //
// This will produce an error if the object already exists // This will produce an error if the object already exists.
// //
// Copy the reader in to the new object which is returned // Copy the reader in to the new object which is returned.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
@ -857,9 +857,9 @@ func (f *Fs) rename(ctx context.Context, id, name string) (item *api.Item, err e
// Copy src to this remote using server side copy operations. // Copy src to this remote using server side copy operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -960,9 +960,9 @@ func (f *Fs) move(ctx context.Context, srcID, parentID string) (item *api.Item,
// Move src to this remote using server side move operations. // Move src to this remote using server side move operations.
// //
// This is stored with the remote path given // This is stored with the remote path given.
// //
// It returns the destination Object and a possible error // It returns the destination Object and a possible error.
// //
// Will only be called if src.Fs().Name() == f.Name() // Will only be called if src.Fs().Name() == f.Name()
// //
@ -1152,7 +1152,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// ModTime returns the modification time of the object // ModTime returns the modification time of the object
// //
//
// It attempts to read the objects mtime and if that isn't present the // It attempts to read the objects mtime and if that isn't present the
// LastModified returned in the http headers // LastModified returned in the http headers
func (o *Object) ModTime(ctx context.Context) time.Time { func (o *Object) ModTime(ctx context.Context) time.Time {
@ -1236,7 +1235,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
// Update the object with the contents of the io.Reader, modTime and size // Update the object with the contents of the io.Reader, modTime and size
// //
// If existing is set then it updates the object rather than creating a new one // If existing is set then it updates the object rather than creating a new one.
// //
// The new object may have been created if an error is returned // The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) { func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {

View File

@ -56,7 +56,8 @@ const (
// logReplacements make modern test logs comparable with golden dir. // logReplacements make modern test logs comparable with golden dir.
// It is a string slice of even length with this structure: // It is a string slice of even length with this structure:
// {`matching regular expression`, "mangled result string", ...} //
// {`matching regular expression`, "mangled result string", ...}
var logReplacements = []string{ var logReplacements = []string{
// skip syslog facility markers // skip syslog facility markers
`^(<[1-9]>)(INFO |ERROR |NOTICE|DEBUG ):(.*)$`, "$2:$3", `^(<[1-9]>)(INFO |ERROR |NOTICE|DEBUG ):(.*)$`, "$2:$3",

View File

@ -24,8 +24,8 @@ const ListingHeader = "# bisync listing v1 from"
// lineRegex and lineFormat define listing line format // lineRegex and lineFormat define listing line format
// //
// flags <- size -> <- hash -> id <------------ modtime -----------> "<----- remote" // flags <- size -> <- hash -> id <------------ modtime -----------> "<----- remote"
// - 3009805 md5:xxxxxx - 2006-01-02T15:04:05.000000000-0700 "12 - Wait.mp3" // - 3009805 md5:xxxxxx - 2006-01-02T15:04:05.000000000-0700 "12 - Wait.mp3"
// //
// flags: "-" for a file and "d" for a directory (reserved) // flags: "-" for a file and "d" for a directory (reserved)
// hash: "type:value" or "-" (example: "md5:378840336ab14afa9c6b8d887e68a340") // hash: "type:value" or "-" (example: "md5:378840336ab14afa9c6b8d887e68a340")

View File

@ -8,7 +8,7 @@ package cmount
import ( import (
"errors" "errors"
"github.com/rclone/rclone/cmd/mountlib" "github.com/rclone/rclone/cmd/mountlib"
"github.com/rclone/rclone/vfs" "github.com/rclone/rclone/vfs"
) )

View File

@ -4,9 +4,9 @@
package cmount package cmount
import ( import (
"errors"
"fmt" "fmt"
"os" "os"
"errors"
"path/filepath" "path/filepath"
"regexp" "regexp"

View File

@ -19,16 +19,16 @@ import (
// applyOptions configures volume from request options. // applyOptions configures volume from request options.
// //
// There are 5 special options: // There are 5 special options:
// - "remote" aka "fs" determines existing remote from config file // - "remote" aka "fs" determines existing remote from config file
// with a path or on-the-fly remote using the ":backend:" syntax. // with a path or on-the-fly remote using the ":backend:" syntax.
// It is usually named "remote" in documentation but can be aliased as // It is usually named "remote" in documentation but can be aliased as
// "fs" to avoid confusion with the "remote" option of some backends. // "fs" to avoid confusion with the "remote" option of some backends.
// - "type" is equivalent to the ":backend:" syntax (optional). // - "type" is equivalent to the ":backend:" syntax (optional).
// - "path" provides explicit on-remote path for "type" (optional). // - "path" provides explicit on-remote path for "type" (optional).
// - "mount-type" can be "mount", "cmount" or "mount2", defaults to // - "mount-type" can be "mount", "cmount" or "mount2", defaults to
// first found (optional). // first found (optional).
// - "persist" is reserved for future to create remotes persisted // - "persist" is reserved for future to create remotes persisted
// in rclone.conf similar to rcd (optional). // in rclone.conf similar to rcd (optional).
// //
// Unlike rcd we use the flat naming scheme for mount, vfs and backend // Unlike rcd we use the flat naming scheme for mount, vfs and backend
// options without substructures. Dashes, underscores and mixed case // options without substructures. Dashes, underscores and mixed case

View File

@ -185,26 +185,27 @@ func (s *server) serve() error {
} }
// close stops the ftp server // close stops the ftp server
//
//lint:ignore U1000 unused when not building linux //lint:ignore U1000 unused when not building linux
func (s *server) close() error { func (s *server) close() error {
fs.Logf(s.f, "Stopping FTP on %s", s.srv.Hostname+":"+strconv.Itoa(s.srv.Port)) fs.Logf(s.f, "Stopping FTP on %s", s.srv.Hostname+":"+strconv.Itoa(s.srv.Port))
return s.srv.Shutdown() return s.srv.Shutdown()
} }
//Logger ftp logger output formatted message // Logger ftp logger output formatted message
type Logger struct{} type Logger struct{}
//Print log simple text message // Print log simple text message
func (l *Logger) Print(sessionID string, message interface{}) { func (l *Logger) Print(sessionID string, message interface{}) {
fs.Infof(sessionID, "%s", message) fs.Infof(sessionID, "%s", message)
} }
//Printf log formatted text message // Printf log formatted text message
func (l *Logger) Printf(sessionID string, format string, v ...interface{}) { func (l *Logger) Printf(sessionID string, format string, v ...interface{}) {
fs.Infof(sessionID, format, v...) fs.Infof(sessionID, format, v...)
} }
//PrintCommand log formatted command execution // PrintCommand log formatted command execution
func (l *Logger) PrintCommand(sessionID string, command string, params string) { func (l *Logger) PrintCommand(sessionID string, command string, params string) {
if command == "PASS" { if command == "PASS" {
fs.Infof(sessionID, "> PASS ****") fs.Infof(sessionID, "> PASS ****")
@ -213,7 +214,7 @@ func (l *Logger) PrintCommand(sessionID string, command string, params string) {
} }
} }
//PrintResponse log responses // PrintResponse log responses
func (l *Logger) PrintResponse(sessionID string, code int, message string) { func (l *Logger) PrintResponse(sessionID string, code int, message string) {
fs.Infof(sessionID, "< %d %s", code, message) fs.Infof(sessionID, "< %d %s", code, message)
} }
@ -237,7 +238,7 @@ func (s *server) NewDriver() (ftp.Driver, error) {
return d, nil return d, nil
} }
//Driver implementation of ftp server // Driver implementation of ftp server
type Driver struct { type Driver struct {
s *server s *server
vfs *vfs.VFS vfs *vfs.VFS
@ -265,7 +266,7 @@ func (d *Driver) CheckPasswd(user, pass string) (ok bool, err error) {
return true, nil return true, nil
} }
//Stat get information on file or folder // Stat get information on file or folder
func (d *Driver) Stat(path string) (fi ftp.FileInfo, err error) { func (d *Driver) Stat(path string) (fi ftp.FileInfo, err error) {
defer log.Trace(path, "")("fi=%+v, err = %v", &fi, &err) defer log.Trace(path, "")("fi=%+v, err = %v", &fi, &err)
n, err := d.vfs.Stat(path) n, err := d.vfs.Stat(path)
@ -275,7 +276,7 @@ func (d *Driver) Stat(path string) (fi ftp.FileInfo, err error) {
return &FileInfo{n, n.Mode(), d.vfs.Opt.UID, d.vfs.Opt.GID}, err return &FileInfo{n, n.Mode(), d.vfs.Opt.UID, d.vfs.Opt.GID}, err
} }
//ChangeDir move current folder // ChangeDir move current folder
func (d *Driver) ChangeDir(path string) (err error) { func (d *Driver) ChangeDir(path string) (err error) {
d.lock.Lock() d.lock.Lock()
defer d.lock.Unlock() defer d.lock.Unlock()
@ -290,7 +291,7 @@ func (d *Driver) ChangeDir(path string) (err error) {
return nil return nil
} }
//ListDir list content of a folder // ListDir list content of a folder
func (d *Driver) ListDir(path string, callback func(ftp.FileInfo) error) (err error) { func (d *Driver) ListDir(path string, callback func(ftp.FileInfo) error) (err error) {
d.lock.Lock() d.lock.Lock()
defer d.lock.Unlock() defer d.lock.Unlock()
@ -326,7 +327,7 @@ func (d *Driver) ListDir(path string, callback func(ftp.FileInfo) error) (err er
return nil return nil
} }
//DeleteDir delete a folder and his content // DeleteDir delete a folder and his content
func (d *Driver) DeleteDir(path string) (err error) { func (d *Driver) DeleteDir(path string) (err error) {
d.lock.Lock() d.lock.Lock()
defer d.lock.Unlock() defer d.lock.Unlock()
@ -345,7 +346,7 @@ func (d *Driver) DeleteDir(path string) (err error) {
return nil return nil
} }
//DeleteFile delete a file // DeleteFile delete a file
func (d *Driver) DeleteFile(path string) (err error) { func (d *Driver) DeleteFile(path string) (err error) {
d.lock.Lock() d.lock.Lock()
defer d.lock.Unlock() defer d.lock.Unlock()
@ -364,7 +365,7 @@ func (d *Driver) DeleteFile(path string) (err error) {
return nil return nil
} }
//Rename rename a file or folder // Rename rename a file or folder
func (d *Driver) Rename(oldName, newName string) (err error) { func (d *Driver) Rename(oldName, newName string) (err error) {
d.lock.Lock() d.lock.Lock()
defer d.lock.Unlock() defer d.lock.Unlock()
@ -372,7 +373,7 @@ func (d *Driver) Rename(oldName, newName string) (err error) {
return d.vfs.Rename(oldName, newName) return d.vfs.Rename(oldName, newName)
} }
//MakeDir create a folder // MakeDir create a folder
func (d *Driver) MakeDir(path string) (err error) { func (d *Driver) MakeDir(path string) (err error) {
d.lock.Lock() d.lock.Lock()
defer d.lock.Unlock() defer d.lock.Unlock()
@ -385,7 +386,7 @@ func (d *Driver) MakeDir(path string) (err error) {
return err return err
} }
//GetFile download a file // GetFile download a file
func (d *Driver) GetFile(path string, offset int64) (size int64, fr io.ReadCloser, err error) { func (d *Driver) GetFile(path string, offset int64) (size int64, fr io.ReadCloser, err error) {
d.lock.Lock() d.lock.Lock()
defer d.lock.Unlock() defer d.lock.Unlock()
@ -417,7 +418,7 @@ func (d *Driver) GetFile(path string, offset int64) (size int64, fr io.ReadClose
return node.Size(), handle, nil return node.Size(), handle, nil
} }
//PutFile upload a file // PutFile upload a file
func (d *Driver) PutFile(path string, data io.Reader, appendData bool) (n int64, err error) { func (d *Driver) PutFile(path string, data io.Reader, appendData bool) (n int64, err error) {
d.lock.Lock() d.lock.Lock()
defer d.lock.Unlock() defer d.lock.Unlock()
@ -479,7 +480,7 @@ func (d *Driver) PutFile(path string, data io.Reader, appendData bool) (n int64,
return bytes, nil return bytes, nil
} }
//FileInfo struct to hold file info for ftp server // FileInfo struct to hold file info for ftp server
type FileInfo struct { type FileInfo struct {
os.FileInfo os.FileInfo
@ -488,12 +489,12 @@ type FileInfo struct {
group uint32 group uint32
} }
//Mode return mode of file. // Mode return mode of file.
func (f *FileInfo) Mode() os.FileMode { func (f *FileInfo) Mode() os.FileMode {
return f.mode return f.mode
} }
//Owner return owner of file. Try to find the username if possible // Owner return owner of file. Try to find the username if possible
func (f *FileInfo) Owner() string { func (f *FileInfo) Owner() string {
str := fmt.Sprint(f.owner) str := fmt.Sprint(f.owner)
u, err := user.LookupId(str) u, err := user.LookupId(str)
@ -503,7 +504,7 @@ func (f *FileInfo) Owner() string {
return u.Username return u.Username
} }
//Group return group of file. Try to find the group name if possible // Group return group of file. Try to find the group name if possible
func (f *FileInfo) Group() string { func (f *FileInfo) Group() string {
str := fmt.Sprint(f.group) str := fmt.Sprint(f.group)
g, err := user.LookupGroupId(str) g, err := user.LookupGroupId(str)

View File

@ -2,7 +2,6 @@
// //
// The interface is used to perform end-to-end test of // The interface is used to perform end-to-end test of
// commands, flags, environment variables etc. // commands, flags, environment variables etc.
//
package cmdtest package cmdtest
// The rest of this file is a 1:1 copy from rclone.go // The rest of this file is a 1:1 copy from rclone.go

View File

@ -208,7 +208,7 @@ func (x *BwTimetable) Set(s string) error {
return nil return nil
} }
// Difference in minutes between lateDayOfWeekHHMM and earlyDayOfWeekHHMM // Difference in minutes between lateDayOfWeekHHMM and earlyDayOfWeekHHMM
func timeDiff(lateDayOfWeekHHMM int, earlyDayOfWeekHHMM int) int { func timeDiff(lateDayOfWeekHHMM int, earlyDayOfWeekHHMM int) int {
lateTimeMinutes := (lateDayOfWeekHHMM / 10000) * 24 * 60 lateTimeMinutes := (lateDayOfWeekHHMM / 10000) * 24 * 60

View File

@ -6,14 +6,14 @@ import (
) )
/* /*
Calculator calculates the minimum chunk size needed to fit within the maximum number of parts, rounded up to the nearest fs.Mebi Calculator calculates the minimum chunk size needed to fit within the maximum number of parts, rounded up to the nearest fs.Mebi
For most backends, (chunk_size) * (concurrent_upload_routines) memory will be required so we want to use the smallest For most backends, (chunk_size) * (concurrent_upload_routines) memory will be required so we want to use the smallest
possible chunk size that's going to allow the upload to proceed. Rounding up to the nearest fs.Mebi on the assumption possible chunk size that's going to allow the upload to proceed. Rounding up to the nearest fs.Mebi on the assumption
that some backends may only allow integer type parameters when specifying the chunk size. that some backends may only allow integer type parameters when specifying the chunk size.
Returns the default chunk size if it is sufficiently large enough to support the given file size otherwise returns the Returns the default chunk size if it is sufficiently large enough to support the given file size otherwise returns the
smallest chunk size necessary to allow the upload to proceed. smallest chunk size necessary to allow the upload to proceed.
*/ */
func Calculator(objInfo fs.ObjectInfo, maxParts int, defaultChunkSize fs.SizeSuffix) fs.SizeSuffix { func Calculator(objInfo fs.ObjectInfo, maxParts int, defaultChunkSize fs.SizeSuffix) fs.SizeSuffix {
fileSize := fs.SizeSuffix(objInfo.Size()) fileSize := fs.SizeSuffix(objInfo.Size())

View File

@ -12,9 +12,9 @@ import (
// //
// It expects 1, 2 or 3 arguments // It expects 1, 2 or 3 arguments
// //
// rclone authorize "fs name" // rclone authorize "fs name"
// rclone authorize "fs name" "base64 encoded JSON blob" // rclone authorize "fs name" "base64 encoded JSON blob"
// rclone authorize "fs name" "client id" "client secret" // rclone authorize "fs name" "client id" "client secret"
func Authorize(ctx context.Context, args []string, noAutoBrowser bool) error { func Authorize(ctx context.Context, args []string, noAutoBrowser bool) error {
ctx = suppressConfirm(ctx) ctx = suppressConfirm(ctx)
ctx = fs.ConfigOAuthOnly(ctx) ctx = fs.ConfigOAuthOnly(ctx)

View File

@ -301,9 +301,9 @@ func (f *Filter) Add(Include bool, glob string) error {
// //
// These are // These are
// //
// + glob
// - glob // - glob
// ! // - glob
// !
// //
// '+' includes the glob, '-' excludes it and '!' resets the filter list // '+' includes the glob, '-' excludes it and '!' resets the filter list
// //

View File

@ -15,14 +15,14 @@ type LogLevel byte
// Log levels. These are the syslog levels of which we only use a // Log levels. These are the syslog levels of which we only use a
// subset. // subset.
// //
// LOG_EMERG system is unusable // LOG_EMERG system is unusable
// LOG_ALERT action must be taken immediately // LOG_ALERT action must be taken immediately
// LOG_CRIT critical conditions // LOG_CRIT critical conditions
// LOG_ERR error conditions // LOG_ERR error conditions
// LOG_WARNING warning conditions // LOG_WARNING warning conditions
// LOG_NOTICE normal, but significant, condition // LOG_NOTICE normal, but significant, condition
// LOG_INFO informational message // LOG_INFO informational message
// LOG_DEBUG debug-level message // LOG_DEBUG debug-level message
const ( const (
LogLevelEmergency LogLevel = iota LogLevelEmergency LogLevel = iota
LogLevelAlert LogLevelAlert

View File

@ -169,7 +169,9 @@ func convertMountHelperArgs(origArgs []string) ([]string, error) {
// parseHelperOptionString deconstructs the -o value into slice of options // parseHelperOptionString deconstructs the -o value into slice of options
// in a way similar to connection strings. // in a way similar to connection strings.
// Example: // Example:
// param1=value,param2="qvalue",param3='item1,item2',param4="a ""b"" 'c'" //
// param1=value,param2="qvalue",param3='item1,item2',param4="a ""b"" 'c'"
//
// An error may be returned if the remote name has invalid characters // An error may be returned if the remote name has invalid characters
// or the parameters are invalid or the path is empty. // or the parameters are invalid or the path is empty.
// //

View File

@ -40,10 +40,10 @@ type OpenOption interface {
// //
// Examples: // Examples:
// //
// RangeOption{Start: 0, End: 99} - fetch the first 100 bytes // RangeOption{Start: 0, End: 99} - fetch the first 100 bytes
// RangeOption{Start: 100, End: 199} - fetch the second 100 bytes // RangeOption{Start: 100, End: 199} - fetch the second 100 bytes
// RangeOption{Start: 100, End: -1} - fetch bytes from offset 100 to the end // RangeOption{Start: 100, End: -1} - fetch bytes from offset 100 to the end
// RangeOption{Start: -1, End: 100} - fetch the last 100 bytes // RangeOption{Start: -1, End: 100} - fetch the last 100 bytes
// //
// A RangeOption implements a single byte-range-spec from // A RangeOption implements a single byte-range-spec from
// https://tools.ietf.org/html/rfc7233#section-2.1 // https://tools.ietf.org/html/rfc7233#section-2.1

View File

@ -44,7 +44,7 @@ import (
// CheckHashes checks the two files to see if they have common // CheckHashes checks the two files to see if they have common
// known hash types and compares them // known hash types and compares them
// //
// Returns // Returns.
// //
// equal - which is equality of the hashes // equal - which is equality of the hashes
// //
@ -911,7 +911,7 @@ var SyncPrintf = func(format string, a ...interface{}) {
// Synchronized fmt.Fprintf // Synchronized fmt.Fprintf
// //
// Ignores errors from Fprintf // Ignores errors from Fprintf.
// //
// Updated to print to terminal if no writer is defined // Updated to print to terminal if no writer is defined
// This special behavior is used to allow easier replacement of the print to terminal code by progress // This special behavior is used to allow easier replacement of the print to terminal code by progress
@ -981,7 +981,7 @@ func CountStringField(count int64, humanReadable bool, rawWidth int) string {
// List the Fs to the supplied writer // List the Fs to the supplied writer
// //
// Shows size and path - obeys includes and excludes // Shows size and path - obeys includes and excludes.
// //
// Lists in parallel which may get them out of order // Lists in parallel which may get them out of order
func List(ctx context.Context, f fs.Fs, w io.Writer) error { func List(ctx context.Context, f fs.Fs, w io.Writer) error {
@ -993,7 +993,7 @@ func List(ctx context.Context, f fs.Fs, w io.Writer) error {
// ListLong lists the Fs to the supplied writer // ListLong lists the Fs to the supplied writer
// //
// Shows size, mod time and path - obeys includes and excludes // Shows size, mod time and path - obeys includes and excludes.
// //
// Lists in parallel which may get them out of order // Lists in parallel which may get them out of order
func ListLong(ctx context.Context, f fs.Fs, w io.Writer) error { func ListLong(ctx context.Context, f fs.Fs, w io.Writer) error {

View File

@ -499,8 +499,7 @@ func TestRcFsInfo(t *testing.T) {
} }
//operations/uploadfile : Tests if upload file succeeds // operations/uploadfile : Tests if upload file succeeds
//
func TestUploadFile(t *testing.T) { func TestUploadFile(t *testing.T) {
r, call := rcNewRun(t, "operations/uploadfile") r, call := rcNewRun(t, "operations/uploadfile")
defer r.Finalise() defer r.Finalise()

View File

@ -31,7 +31,7 @@ var (
// NewReOpen makes a handle which will reopen itself and seek to where it was on errors // NewReOpen makes a handle which will reopen itself and seek to where it was on errors
// //
// If hashOption is set this will be applied when reading from the start // If hashOption is set this will be applied when reading from the start.
// //
// If rangeOption is set then this will applied when reading from the // If rangeOption is set then this will applied when reading from the
// start, and updated on retries. // start, and updated on retries.

View File

@ -48,7 +48,6 @@ func NotErrParamNotFound(err error) bool {
// ErrParamInvalid - this is returned from the Get* functions if the // ErrParamInvalid - this is returned from the Get* functions if the
// parameter is invalid. // parameter is invalid.
// //
//
// Returning an error of this type from an rc.Func will cause the http // Returning an error of this type from an rc.Func will cause the http
// method to return http.StatusBadRequest // method to return http.StatusBadRequest
type ErrParamInvalid struct { type ErrParamInvalid struct {

View File

@ -227,12 +227,12 @@ func (p *Plugins) GetPluginByName(name string) (out *PackageJSON, err error) {
} }
// getAuthorRepoBranchGithub gives author, repoName and branch from a github.com url // getAuthorRepoBranchGithub gives author, repoName and branch from a github.com url
//
// url examples: // url examples:
// https://github.com/rclone/rclone-webui-react/ // https://github.com/rclone/rclone-webui-react/
// http://github.com/rclone/rclone-webui-react // http://github.com/rclone/rclone-webui-react
// https://github.com/rclone/rclone-webui-react/tree/caman-js // https://github.com/rclone/rclone-webui-react/tree/caman-js
// github.com/rclone/rclone-webui-react // github.com/rclone/rclone-webui-react
//
func getAuthorRepoBranchGithub(url string) (author string, repoName string, branch string, err error) { func getAuthorRepoBranchGithub(url string) (author string, repoName string, branch string, err error) {
repoURL := url repoURL := url
repoURL = strings.Replace(repoURL, "https://", "", 1) repoURL = strings.Replace(repoURL, "https://", "", 1)

View File

@ -130,16 +130,16 @@ const (
// Option is describes an option for the config wizard // Option is describes an option for the config wizard
// //
// This also describes command line options and environment variables // This also describes command line options and environment variables.
// //
// To create a multiple-choice option, specify the possible values // To create a multiple-choice option, specify the possible values
// in the Examples property. Whether the option's value is required // in the Examples property. Whether the option's value is required
// to be one of these depends on other properties: // to be one of these depends on other properties:
// - Default is to allow any value, either from specified examples, // - Default is to allow any value, either from specified examples,
// or any other value. To restrict exclusively to the specified // or any other value. To restrict exclusively to the specified
// examples, also set Exclusive=true. // examples, also set Exclusive=true.
// - If empty string should not be allowed then set Required=true, // - If empty string should not be allowed then set Required=true,
// and do not set Default. // and do not set Default.
type Option struct { type Option struct {
Name string // name of the option in snake_case Name string // name of the option in snake_case
Help string // help, start with a single sentence on a single line that will be extracted for command line help Help string // help, start with a single sentence on a single line that will be extracted for command line help
@ -292,7 +292,7 @@ func Find(name string) (*RegInfo, error) {
// MustFind looks for an Info object for the type name passed in // MustFind looks for an Info object for the type name passed in
// //
// Services are looked up in the config file // Services are looked up in the config file.
// //
// Exits with a fatal error if not found // Exits with a fatal error if not found
func MustFind(name string) *RegInfo { func MustFind(name string) *RegInfo {

View File

@ -301,9 +301,10 @@ func (s *syncCopyMove) processError(err error) {
} }
// Returns the current error (if any) in the order of precedence // Returns the current error (if any) in the order of precedence
// fatalErr //
// normal error // fatalErr
// noRetryErr // normal error
// noRetryErr
func (s *syncCopyMove) currentError() error { func (s *syncCopyMove) currentError() error {
s.errorMu.Lock() s.errorMu.Lock()
defer s.errorMu.Unlock() defer s.errorMu.Unlock()
@ -837,7 +838,7 @@ var errorMaxDurationReached = fserrors.FatalError(errors.New("max transfer durat
// //
// If Delete is true then it deletes any files in fdst that aren't in fsrc // If Delete is true then it deletes any files in fdst that aren't in fsrc
// //
// If DoMove is true then files will be moved instead of copied // If DoMove is true then files will be moved instead of copied.
// //
// dir is the start directory, "" for root // dir is the start directory, "" for root
func (s *syncCopyMove) run() error { func (s *syncCopyMove) run() error {
@ -1083,7 +1084,7 @@ func (s *syncCopyMove) Match(ctx context.Context, dst, src fs.DirEntry) (recurse
// //
// If Delete is true then it deletes any files in fdst that aren't in fsrc // If Delete is true then it deletes any files in fdst that aren't in fsrc
// //
// If DoMove is true then files will be moved instead of copied // If DoMove is true then files will be moved instead of copied.
// //
// dir is the start directory, "" for root // dir is the start directory, "" for root
func runSyncCopyMove(ctx context.Context, fdst, fsrc fs.Fs, deleteMode fs.DeleteMode, DoMove bool, deleteEmptySrcDirs bool, copyEmptySrcDirs bool) error { func runSyncCopyMove(ctx context.Context, fdst, fsrc fs.Fs, deleteMode fs.DeleteMode, DoMove bool, deleteEmptySrcDirs bool, copyEmptySrcDirs bool) error {

View File

@ -50,7 +50,7 @@ type Func func(path string, entries fs.DirEntries, err error) error
// Note that fn will not be called concurrently whereas the directory // Note that fn will not be called concurrently whereas the directory
// listing will proceed concurrently. // listing will proceed concurrently.
// //
// Parent directories are always listed before their children // Parent directories are always listed before their children.
// //
// This is implemented by WalkR if Config.UseListR is true // This is implemented by WalkR if Config.UseListR is true
// and f supports it and level > 1, or WalkN otherwise. // and f supports it and level > 1, or WalkN otherwise.

View File

@ -189,7 +189,7 @@ var (
// PutTestContentsMetadata puts file with given contents to the remote and checks it but unlike TestPutLarge doesn't remove // PutTestContentsMetadata puts file with given contents to the remote and checks it but unlike TestPutLarge doesn't remove
// //
// It uploads the object with the mimeType and metadata passed in if set // It uploads the object with the mimeType and metadata passed in if set.
// //
// It returns the object which will have been checked if check is set // It returns the object which will have been checked if check is set
func PutTestContentsMetadata(ctx context.Context, t *testing.T, f fs.Fs, file *fstest.Item, contents string, check bool, mimeType string, metadata fs.Metadata) fs.Object { func PutTestContentsMetadata(ctx context.Context, t *testing.T, f fs.Fs, file *fstest.Item, contents string, check bool, mimeType string, metadata fs.Metadata) fs.Object {

View File

@ -2,7 +2,6 @@
// need integration testing. // need integration testing.
// //
// See the `test` target in the Makefile. // See the `test` target in the Makefile.
//
package main package main
/* FIXME /* FIXME

View File

@ -111,7 +111,7 @@ func Run() {
// //
// It should be used in a defer statement normally so // It should be used in a defer statement normally so
// //
// defer OnError(&err, cancelFunc)() // defer OnError(&err, cancelFunc)()
// //
// So cancelFunc will be run if the function exits with an error or // So cancelFunc will be run if the function exits with an error or
// at exit. // at exit.

View File

@ -120,7 +120,7 @@ func (c *Cache) Create(bucket string, create CreateFn, exists ExistsFn) (err err
// Remove the bucket with f if it exists // Remove the bucket with f if it exists
// //
// If f returns an error we assume the bucket was not removed // If f returns an error we assume the bucket was not removed.
// //
// If the bucket has already been deleted it returns ErrAlreadyDeleted // If the bucket has already been deleted it returns ErrAlreadyDeleted
func (c *Cache) Remove(bucket string, f func() error) error { func (c *Cache) Remove(bucket string, f func() error) error {

View File

@ -192,7 +192,7 @@ func SplitPath(path string) (directory, leaf string) {
// //
// Path shouldn't start or end with a / // Path shouldn't start or end with a /
// //
// If create is set it will make the directory if not found // If create is set it will make the directory if not found.
// //
// It will call FindRoot if it hasn't been called already // It will call FindRoot if it hasn't been called already
func (dc *DirCache) FindDir(ctx context.Context, path string, create bool) (pathID string, err error) { func (dc *DirCache) FindDir(ctx context.Context, path string, create bool) (pathID string, err error) {
@ -282,7 +282,7 @@ func (dc *DirCache) FindPath(ctx context.Context, path string, create bool) (lea
// If successful this changes the root of the cache from the true root // If successful this changes the root of the cache from the true root
// to the root specified by the path passed into New. // to the root specified by the path passed into New.
// //
// Resets the root directory // Resets the root directory.
// //
// If create is set it will make the directory if not found // If create is set it will make the directory if not found
func (dc *DirCache) FindRoot(ctx context.Context, create bool) error { func (dc *DirCache) FindRoot(ctx context.Context, create bool) error {
@ -293,9 +293,9 @@ func (dc *DirCache) FindRoot(ctx context.Context, create bool) error {
// _findRoot finds the root directory if not already found // _findRoot finds the root directory if not already found
// //
// Resets the root directory // Resets the root directory.
// //
// If create is set it will make the directory if not found // If create is set it will make the directory if not found.
// //
// Call with mu held // Call with mu held
func (dc *DirCache) _findRoot(ctx context.Context, create bool) error { func (dc *DirCache) _findRoot(ctx context.Context, create bool) error {
@ -390,7 +390,7 @@ func (dc *DirCache) ResetRoot() {
// It does all the checking, creates intermediate directories and // It does all the checking, creates intermediate directories and
// returns leafs and IDs ready for the move. // returns leafs and IDs ready for the move.
// //
// This returns // This returns:
// //
// - srcID - ID of the source directory // - srcID - ID of the source directory
// - srcDirectoryID - ID of the parent of the source directory // - srcDirectoryID - ID of the parent of the source directory

View File

@ -6,19 +6,21 @@ package encoder
// OS is the encoding used by the local backend for windows platforms // OS is the encoding used by the local backend for windows platforms
// //
// List of replaced characters: // List of replaced characters:
// < (less than) -> '' // FULLWIDTH LESS-THAN SIGN //
// > (greater than) -> '' // FULLWIDTH GREATER-THAN SIGN // < (less than) -> '' // FULLWIDTH LESS-THAN SIGN
// : (colon) -> '' // FULLWIDTH COLON // > (greater than) -> '' // FULLWIDTH GREATER-THAN SIGN
// " (double quote) -> '' // FULLWIDTH QUOTATION MARK // : (colon) -> '' // FULLWIDTH COLON
// \ (backslash) -> '' // FULLWIDTH REVERSE SOLIDUS // " (double quote) -> '' // FULLWIDTH QUOTATION MARK
// | (vertical line) -> '' // FULLWIDTH VERTICAL LINE // \ (backslash) -> '' // FULLWIDTH REVERSE SOLIDUS
// ? (question mark) -> '' // FULLWIDTH QUESTION MARK // | (vertical line) -> '' // FULLWIDTH VERTICAL LINE
// * (asterisk) -> '' // FULLWIDTH ASTERISK // ? (question mark) -> '' // FULLWIDTH QUESTION MARK
// * (asterisk) -> '' // FULLWIDTH ASTERISK
// //
// Additionally names can't end with a period (.) or space ( ). // Additionally names can't end with a period (.) or space ( ).
// List of replaced characters: // List of replaced characters:
// . (period) -> '' // FULLWIDTH FULL STOP //
// (space) -> '␠' // SYMBOL FOR SPACE // . (period) -> '' // FULLWIDTH FULL STOP
// (space) -> '␠' // SYMBOL FOR SPACE
// //
// Also encode invalid UTF-8 bytes as Go can't convert them to UTF-16. // Also encode invalid UTF-8 bytes as Go can't convert them to UTF-16.
// //

View File

@ -3,8 +3,9 @@ package encoder
// Standard defines the encoding that is used for paths in- and output by rclone. // Standard defines the encoding that is used for paths in- and output by rclone.
// //
// List of replaced characters: // List of replaced characters:
// (0x00) -> '␀' // SYMBOL FOR NULL //
// / (slash) -> '' // FULLWIDTH SOLIDUS // (0x00) -> '␀' // SYMBOL FOR NULL
// / (slash) -> '' // FULLWIDTH SOLIDUS
const Standard = (EncodeZero | const Standard = (EncodeZero |
EncodeSlash | EncodeSlash |
EncodeCtl | EncodeCtl |

View File

@ -14,10 +14,11 @@ type WalkFunc func(error) bool
// is stopped and no further calls will be made. // is stopped and no further calls will be made.
// //
// The next error in the chain is determined by the following rules: // The next error in the chain is determined by the following rules:
// the return value of this method is used. //
// - If the current error has a `Unwrap() error` method (golang.org/x/xerrors), // the return value of this method is used.
// the return value of this method is used. // - If the current error has a `Unwrap() error` method (golang.org/x/xerrors),
// - Common errors in the Go runtime that contain an Err field will use this value. // the return value of this method is used.
// - Common errors in the Go runtime that contain an Err field will use this value.
func Walk(err error, f WalkFunc) { func Walk(err error, f WalkFunc) {
for prev := err; err != nil; prev = err { for prev := err; err != nil; prev = err {
if f(err) { if f(err) {

View File

@ -433,10 +433,10 @@ func ConfigOut(state string, oAuth *Options) (*fs.ConfigOut, error) {
// //
// This is called with a state which has pushed on it // This is called with a state which has pushed on it
// //
// state prefixed with "*oauth" // state prefixed with "*oauth"
// state for oauth to return to // state for oauth to return to
// state that returned the OAuth when we wish to recall it // state that returned the OAuth when we wish to recall it
// value that returned the OAuth // value that returned the OAuth
func ConfigOAuth(ctx context.Context, name string, m configmap.Mapper, ri *fs.RegInfo, in fs.ConfigIn) (*fs.ConfigOut, error) { func ConfigOAuth(ctx context.Context, name string, m configmap.Mapper, ri *fs.RegInfo, in fs.ConfigIn) (*fs.ConfigOut, error) {
stateParams, state := fs.StatePop(in.State) stateParams, state := fs.StatePop(in.State)
@ -624,7 +624,7 @@ func fixRedirect(oauthConfig *oauth2.Config) *oauth2.Config {
// configSetup does the initial creation of the token // configSetup does the initial creation of the token
// //
// If opt is nil it will use the default Options // If opt is nil it will use the default Options.
// //
// It will run an internal webserver to receive the results // It will run an internal webserver to receive the results
func configSetup(ctx context.Context, id, name string, m configmap.Mapper, oauthConfig *oauth2.Config, opt *Options) (string, error) { func configSetup(ctx context.Context, id, name string, m configmap.Mapper, oauthConfig *oauth2.Config, opt *Options) (string, error) {

View File

@ -148,7 +148,7 @@ func (p *Pacer) ModifyCalculator(f func(Calculator)) {
// Start a call to the API // Start a call to the API
// //
// This must be called as a pair with endCall // This must be called as a pair with endCall.
// //
// This waits for the pacer token // This waits for the pacer token
func (p *Pacer) beginCall() { func (p *Pacer) beginCall() {

View File

@ -7,7 +7,7 @@
// To create a plugin, write the backend package like it was in-tree // To create a plugin, write the backend package like it was in-tree
// but set the package name to "main". Then, build the plugin with // but set the package name to "main". Then, build the plugin with
// //
// go build -buildmode=plugin -o librcloneplugin_NAME.so // go build -buildmode=plugin -o librcloneplugin_NAME.so
// //
// where NAME equals the plugin's fs.RegInfo.Name. // where NAME equals the plugin's fs.RegInfo.Name.
package plugin package plugin

View File

@ -407,7 +407,7 @@ func MultipartUpload(ctx context.Context, in io.Reader, params url.Values, conte
// CallJSON runs Call and decodes the body as a JSON object into response (if not nil) // CallJSON runs Call and decodes the body as a JSON object into response (if not nil)
// //
// If request is not nil then it will be JSON encoded as the body of the request // If request is not nil then it will be JSON encoded as the body of the request.
// //
// If response is not nil then the response will be JSON decoded into // If response is not nil then the response will be JSON decoded into
// it and resp.Body will be closed. // it and resp.Body will be closed.
@ -430,7 +430,7 @@ func (api *Client) CallJSON(ctx context.Context, opts *Opts, request interface{}
// CallXML runs Call and decodes the body as an XML object into response (if not nil) // CallXML runs Call and decodes the body as an XML object into response (if not nil)
// //
// If request is not nil then it will be XML encoded as the body of the request // If request is not nil then it will be XML encoded as the body of the request.
// //
// If response is not nil then the response will be XML decoded into // If response is not nil then the response will be XML decoded into
// it and resp.Body will be closed. // it and resp.Body will be closed.
@ -438,7 +438,7 @@ func (api *Client) CallJSON(ctx context.Context, opts *Opts, request interface{}
// If response is nil then the resp.Body will be closed only if // If response is nil then the resp.Body will be closed only if
// opts.NoResponse is set. // opts.NoResponse is set.
// //
// See CallJSON for a description of MultipartParams and related opts // See CallJSON for a description of MultipartParams and related opts.
// //
// It will return resp if at all possible, even if err is set // It will return resp if at all possible, even if err is set
func (api *Client) CallXML(ctx context.Context, opts *Opts, request interface{}, response interface{}) (resp *http.Response, err error) { func (api *Client) CallXML(ctx context.Context, opts *Opts, request interface{}, response interface{}) (resp *http.Response, err error) {

View File

@ -22,8 +22,8 @@ func RcloneFinalize() {
// RcloneRPCResult is returned from RcloneRPC // RcloneRPCResult is returned from RcloneRPC
// //
// Output will be returned as a serialized JSON object // Output will be returned as a serialized JSON object
// Status is a HTTP status return (200=OK anything else fail) // Status is a HTTP status return (200=OK anything else fail)
type RcloneRPCResult struct { type RcloneRPCResult struct {
Output string Output string
Status int Status int

View File

@ -7,11 +7,11 @@
// //
// Build a shared library like this: // Build a shared library like this:
// //
// go build --buildmode=c-shared -o librclone.so github.com/rclone/rclone/librclone // go build --buildmode=c-shared -o librclone.so github.com/rclone/rclone/librclone
// //
// Build a static library like this: // Build a static library like this:
// //
// go build --buildmode=c-archive -o librclone.a github.com/rclone/rclone/librclone // go build --buildmode=c-archive -o librclone.a github.com/rclone/rclone/librclone
// //
// Both the above commands will also generate `librclone.h` which should // Both the above commands will also generate `librclone.h` which should
// be `#include`d in `C` programs wishing to use the library. // be `#include`d in `C` programs wishing to use the library.
@ -59,8 +59,8 @@ func RcloneFinalize() {
// RcloneRPCResult is returned from RcloneRPC // RcloneRPCResult is returned from RcloneRPC
// //
// Output will be returned as a serialized JSON object // Output will be returned as a serialized JSON object
// Status is a HTTP status return (200=OK anything else fail) // Status is a HTTP status return (200=OK anything else fail)
type RcloneRPCResult struct { //nolint:deadcode type RcloneRPCResult struct { //nolint:deadcode
Output *C.char Output *C.char
Status C.int Status C.int
@ -70,10 +70,10 @@ type RcloneRPCResult struct { //nolint:deadcode
// and the output is (output, status). This is an exported interface // and the output is (output, status). This is an exported interface
// to the rclone API as described in https://rclone.org/rc/ // to the rclone API as described in https://rclone.org/rc/
// //
// method is a string, eg "operations/list" // method is a string, eg "operations/list"
// input should be a string with a serialized JSON object // input should be a string with a serialized JSON object
// result.Output will be returned as a string with a serialized JSON object // result.Output will be returned as a string with a serialized JSON object
// result.Status is a HTTP status return (200=OK anything else fail) // result.Status is a HTTP status return (200=OK anything else fail)
// //
// All strings are UTF-8 encoded, on all platforms. // All strings are UTF-8 encoded, on all platforms.
// //

View File

@ -72,7 +72,7 @@ func writeError(path string, in rc.Params, err error, status int) (string, int)
// RPC runs a transaction over the RC // RPC runs a transaction over the RC
// //
// Calling an rc function using JSON to input parameters and output the resulted JSON // Calling an rc function using JSON to input parameters and output the resulted JSON.
// //
// operations/uploadfile and core/command are not supported as they need request or response object // operations/uploadfile and core/command are not supported as they need request or response object
// modified from handlePost in rcserver.go // modified from handlePost in rcserver.go

View File

@ -555,7 +555,7 @@ func (d *Dir) _newManageVirtuals() manageVirtuals {
// This should be called for every entry added to the directory // This should be called for every entry added to the directory
// //
// It returns true if this entry should be skipped // It returns true if this entry should be skipped.
// //
// must be called with the Dir lock held // must be called with the Dir lock held
func (mv manageVirtuals) add(d *Dir, name string) bool { func (mv manageVirtuals) add(d *Dir, name string) bool {

View File

@ -645,15 +645,15 @@ func (f *File) Fs() fs.Fs {
// Open a file according to the flags provided // Open a file according to the flags provided
// //
// O_RDONLY open the file read-only. // O_RDONLY open the file read-only.
// O_WRONLY open the file write-only. // O_WRONLY open the file write-only.
// O_RDWR open the file read-write. // O_RDWR open the file read-write.
// //
// O_APPEND append data to the file when writing. // O_APPEND append data to the file when writing.
// O_CREATE create a new file if none exists. // O_CREATE create a new file if none exists.
// O_EXCL used with O_CREATE, file must not exist // O_EXCL used with O_CREATE, file must not exist
// O_SYNC open for synchronous I/O. // O_SYNC open for synchronous I/O.
// O_TRUNC if possible, truncate file when opened // O_TRUNC if possible, truncate file when opened
// //
// We ignore O_SYNC and O_EXCL // We ignore O_SYNC and O_EXCL
func (f *File) Open(flags int) (fd Handle, err error) { func (f *File) Open(flags int) (fd Handle, err error) {

View File

@ -7,7 +7,8 @@ import (
// Help contains text describing file and directory caching to add to // Help contains text describing file and directory caching to add to
// the command help. // the command help.
// Warning: "!" (sic) will be replaced by backticks below, // Warning: "!" (sic) will be replaced by backticks below,
// but the pipe character "|" can be used as is. //
// but the pipe character "|" can be used as is.
var Help = strings.ReplaceAll(` var Help = strings.ReplaceAll(`
### VFS - Virtual File System ### VFS - Virtual File System

View File

@ -215,7 +215,7 @@ func (fh *ReadFileHandle) ReadAt(p []byte, off int64) (n int, err error) {
// This waits for *poff to equal off or aborts after the timeout. // This waits for *poff to equal off or aborts after the timeout.
// //
// Waits here potentially affect all seeks so need to keep them short // Waits here potentially affect all seeks so need to keep them short.
// //
// Call with fh.mu Locked // Call with fh.mu Locked
func waitSequential(what string, remote string, cond *sync.Cond, maxWait time.Duration, poff *int64, off int64) { func waitSequential(what string, remote string, cond *sync.Cond, maxWait time.Duration, poff *int64, off int64) {

View File

@ -139,7 +139,7 @@ func (fh *RWFileHandle) updateSize() {
// close the file handle returning EBADF if it has been // close the file handle returning EBADF if it has been
// closed already. // closed already.
// //
// Must be called with fh.mu held // Must be called with fh.mu held.
// //
// Note that we leave the file around in the cache on error conditions // Note that we leave the file around in the cache on error conditions
// to give the user a chance to recover it. // to give the user a chance to recover it.

View File

@ -339,7 +339,7 @@ func (c *Cache) get(name string) (item *Item, found bool) {
// Item gets a cache item for name // Item gets a cache item for name
// //
// To use it item.Open will need to be called // To use it item.Open will need to be called.
// //
// name should be a remote path not an osPath // name should be a remote path not an osPath
func (c *Cache) Item(name string) (item *Item) { func (c *Cache) Item(name string) (item *Item) {

View File

@ -137,8 +137,8 @@ func New(item Item, opt *vfscommon.Options, remote string, src fs.Object) (dls *
// //
// It should be called with // It should be called with
// //
// n bytes downloaded // n bytes downloaded
// err is error from download // err is error from download
// //
// call with lock held // call with lock held
func (dls *Downloaders) _countErrors(n int64, err error) { func (dls *Downloaders) _countErrors(n int64, err error) {

View File

@ -53,7 +53,7 @@ func (item *testItem) FindMissing(r ranges.Range) (outr ranges.Range) {
// WriteAtNoOverwrite writes b to the file, but will not overwrite // WriteAtNoOverwrite writes b to the file, but will not overwrite
// already present ranges. // already present ranges.
// //
// This is used by the downloader to write bytes to the file // This is used by the downloader to write bytes to the file.
// //
// It returns n the total bytes processed and skipped the number of // It returns n the total bytes processed and skipped the number of
// bytes which were processed but not actually written to the file. // bytes which were processed but not actually written to the file.

View File

@ -286,7 +286,7 @@ func (item *Item) _truncate(size int64) (err error) {
// Truncate the item to the current size, creating if necessary // Truncate the item to the current size, creating if necessary
// //
// This does not mark the object as dirty // This does not mark the object as dirty.
// //
// call with the lock held // call with the lock held
func (item *Item) _truncateToCurrentSize() (err error) { func (item *Item) _truncateToCurrentSize() (err error) {
@ -725,7 +725,7 @@ func (item *Item) Close(storeFn StoreFn) (err error) {
// reload is called with valid items recovered from a cache reload. // reload is called with valid items recovered from a cache reload.
// //
// If they are dirty then it makes sure they get uploaded // If they are dirty then it makes sure they get uploaded.
// //
// it is called before the cache has started so opens will be 0 and // it is called before the cache has started so opens will be 0 and
// metaDirty will be false. // metaDirty will be false.
@ -766,7 +766,7 @@ func (item *Item) reload(ctx context.Context) error {
// If we have local modifications then they take precedence // If we have local modifications then they take precedence
// over a change in the remote // over a change in the remote
// //
// It ensures the file is the correct size for the object // It ensures the file is the correct size for the object.
// //
// call with lock held // call with lock held
func (item *Item) _checkObject(o fs.Object) error { func (item *Item) _checkObject(o fs.Object) error {
@ -1305,7 +1305,7 @@ func (item *Item) WriteAt(b []byte, off int64) (n int, err error) {
// WriteAtNoOverwrite writes b to the file, but will not overwrite // WriteAtNoOverwrite writes b to the file, but will not overwrite
// already present ranges. // already present ranges.
// //
// This is used by the downloader to write bytes to the file // This is used by the downloader to write bytes to the file.
// //
// It returns n the total bytes processed and skipped the number of // It returns n the total bytes processed and skipped the number of
// bytes which were processed but not actually written to the file. // bytes which were processed but not actually written to the file.

View File

@ -252,7 +252,7 @@ func (wb *WriteBack) SetID(pid *Handle) {
// If id is 0 then a new item will always be created and the new // If id is 0 then a new item will always be created and the new
// Handle will be returned. // Handle will be returned.
// //
// Use SetID to create Handles in advance of calling Add // Use SetID to create Handles in advance of calling Add.
// //
// If modified is false then it it doesn't cancel a pending upload if // If modified is false then it it doesn't cancel a pending upload if
// there is one as there is no need. // there is one as there is no need.

View File

@ -181,9 +181,12 @@ func startMount(mountFn mountlib.MountFn, useVFS bool, opts string) {
// line to send to stdout with an exit flag. // line to send to stdout with an exit flag.
// //
// The format of the lines is // The format of the lines is
// command \t parameter (optional) //
// command \t parameter (optional)
//
// The response should be // The response should be
// OK|ERR \t result (optional) //
// OK|ERR \t result (optional)
func doMountCommand(vfs *vfs.VFS, rx string) (tx string, exit bool) { func doMountCommand(vfs *vfs.VFS, rx string) (tx string, exit bool) {
command := strings.Split(rx, "\t") command := strings.Split(rx, "\t")
// log.Printf("doMountCommand: %q received", command) // log.Printf("doMountCommand: %q received", command)