"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
dropbox: Issue an error message when trying to upload bad file name - fixes #108
Nick Craig-Woodbc19e2d84b8c
diff --git a/docs/content/dropbox.md b/docs/content/dropbox.mdindex fa2e41cdf..c95521f1b 100644--- a/docs/content/dropbox.md+++ b/docs/content/dropbox.md@@ -80,3 +80,9 @@ MD5SUMs so syncs will effectively have the `--size-only` flag set.Note that Dropbox is case sensitive so you can't have a file called"Hello.doc" and one called "hello.doc".++There are some file names such as `thumbs.db` which Dropbox can't+store. There is a full list of them in the ["Ignored Files" section+of this document](https://www.dropbox.com/en/help/145). Rclone will+issue an error message `File name disallowed - not uploading` if it+attempt to upload one of those file names, but the sync won't fail.diff --git a/dropbox/dropbox.go b/dropbox/dropbox.goindex f327bba62..077dd6f29 100644--- a/dropbox/dropbox.go+++ b/dropbox/dropbox.go@@ -36,6 +36,7 @@ import ("io/ioutil""log""path"+ "regexp""strings""time"@@ -51,6 +52,10 @@ const (metadataLimit = dropbox.MetadataLimitDefault // max items to fetch at once)+// A regexp matching path names for files Dropbox ignores+// See https://www.dropbox.com/en/help/145 - Ignored files+var ignoredFiles = regexp.MustCompile(`(?i)(^|/)(desktop\.ini|thumbs\.db|\.ds_store|icon\r|\.dropbox|\.dropbox.attr)$`)+// Register with Fsfunc init() {fs.Register(&fs.FsInfo{@@ -542,7 +547,12 @@ func (o *FsObjectDropbox) Open() (in io.ReadCloser, err error) {//// The new object may have been created if an error is returnedfunc (o *FsObjectDropbox) Update(in io.Reader, modTime time.Time, size int64) error {- entry, err := o.dropbox.db.UploadByChunk(ioutil.NopCloser(in), uploadChunkSize, o.remotePath(), true, "")+ remote := o.remotePath()+ if ignoredFiles.MatchString(remote) {+ fs.ErrorLog(o, "File name disallowed - not uploading")+ return nil+ }+ entry, err := o.dropbox.db.UploadByChunk(ioutil.NopCloser(in), uploadChunkSize, remote, true, "")if err != nil {return fmt.Errorf("Upload failed: %s", err)}