mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
lint: remove unused import
This commit is contained in:
parent
bae4c4381f
commit
3988733c31
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/Masterminds/squirrel"
|
||||
"github.com/deluan/rest"
|
||||
@ -121,8 +120,19 @@ func (r *shareRepositoryWrapper) Save(entity interface{}) (string, error) {
|
||||
return "", model.ErrNotFound
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(s.Contents) > 30 {
|
||||
s.Contents = string([]rune(s.Contents)[:26]) + "..."
|
||||
var runeCount int
|
||||
var truncateIndex int
|
||||
|
||||
for i := range s.Contents {
|
||||
runeCount++
|
||||
|
||||
if runeCount == 27 {
|
||||
truncateIndex = i
|
||||
}
|
||||
}
|
||||
|
||||
if runeCount > 30 {
|
||||
s.Contents = s.Contents[:truncateIndex] + "..."
|
||||
}
|
||||
|
||||
id, err = r.Persistable.Save(s)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user