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

This commit is contained in:
Joanna Marek 2018-09-16 11:08:24 +00:00 committed by Nick Craig-Wood
parent cfe65f1e72
commit e022ffce0f

View File

@ -256,11 +256,14 @@ func (acc *Account) String() string {
etas = "0s" etas = "0s"
} }
} }
name := []rune(acc.name) name := []rune(acc.name)
if fs.Config.StatsFileNameLength > 0 { if fs.Config.StatsFileNameLength > 0 {
if len(name) > fs.Config.StatsFileNameLength { if len(name) > fs.Config.StatsFileNameLength {
where := len(name) - fs.Config.StatsFileNameLength suffixLength := fs.Config.StatsFileNameLength / 2
name = append([]rune{'.', '.', '.'}, name[where:]...) prefixLength := fs.Config.StatsFileNameLength - suffixLength
suffixStart := len(name) - suffixLength
name = append(append(name[:prefixLength], '…'), name[suffixStart:]...)
} }
} }