Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

accounting: change too long names cutting mechanism - fixes #2490

Joanna Mareke022ffce0f9b
diff --git a/fs/accounting/accounting.go b/fs/accounting/accounting.go
index 398588d72..ef12c286e 100644
--- a/fs/accounting/accounting.go
+++ b/fs/accounting/accounting.go
@@ -256,11 +256,14 @@ func (acc *Account) String() string {
etas = "0s"
}
}
+
name := []rune(acc.name)
if fs.Config.StatsFileNameLength > 0 {
if len(name) > fs.Config.StatsFileNameLength {
- where := len(name) - fs.Config.StatsFileNameLength
- name = append([]rune{'.', '.', '.'}, name[where:]...)
+ suffixLength := fs.Config.StatsFileNameLength / 2
+ prefixLength := fs.Config.StatsFileNameLength - suffixLength
+ suffixStart := len(name) - suffixLength
+ name = append(append(name[:prefixLength], '…'), name[suffixStart:]...)
}
}