mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
#2287 Truncate repository name if too long
This commit is contained in:
@@ -453,6 +453,15 @@ func Subtract(left interface{}, right interface{}) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
// EllipsisString returns a truncated short string,
|
||||
// it appends '...' in the end of the length of string is too large.
|
||||
func EllipsisString(str string, length int) string {
|
||||
if len(str) < length {
|
||||
return str
|
||||
}
|
||||
return str[:length-3] + "..."
|
||||
}
|
||||
|
||||
// StringsToInt64s converts a slice of string to a slice of int64.
|
||||
func StringsToInt64s(strs []string) []int64 {
|
||||
ints := make([]int64, len(strs))
|
||||
|
Reference in New Issue
Block a user