Skip to content

Commit

Permalink
Fix filename overflow to work properly with non-ASCII filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
70sh1 committed Dec 7, 2023
1 parent c8ff523 commit 3e91eca
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,11 @@ func closeAndRemove(f *os.File) {
}

func filenameOverflow(s string, n int) string {
if len(s) > n {
return s[:n] + "..."
r := []rune(s)
if len(r) < n {
return s
}
return s
return string(r[:n]) + "..."
}

func formatSize(b int64) string {
Expand Down

0 comments on commit 3e91eca

Please sign in to comment.