Correct sorting of strings containing numbers without leading zeros (#357)

Co-authored-by: Konstantin Kayukin <t_kkayukin@admarketplace.com>
This commit is contained in:
Константин
2024-02-16 20:01:03 +01:00
committed by GitHub
parent d1fbd2d311
commit cbf7764d08
2 changed files with 53 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package torr
import (
"errors"
utils2 "server/utils"
"sort"
"sync"
"time"
@@ -331,7 +332,7 @@ func (t *Torrent) Status() *state.TorrentStatus {
files := t.Files()
sort.Slice(files, func(i, j int) bool {
return files[i].Path() < files[j].Path()
return utils2.CompareStrings(files[i].Path(), files[j].Path())
})
for i, f := range files {
st.FileStats = append(st.FileStats, &state.TorrentFileStat{