Fix file selection window on Windows that didnt split file with proper separator
This commit is contained in:
parent
b808382169
commit
b289f1eeaa
6 changed files with 47 additions and 40 deletions
14
crates/librqbit/webui/src/helper/getTorrentDisplayName.ts
Normal file
14
crates/librqbit/webui/src/helper/getTorrentDisplayName.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { TorrentDetails } from "../api-types";
|
||||
|
||||
function getLargestFileName(torrentDetails: TorrentDetails): string {
|
||||
const largestFile = torrentDetails.files
|
||||
.filter((f) => f.included)
|
||||
.reduce((prev: any, current: any) =>
|
||||
prev.length > current.length ? prev : current
|
||||
);
|
||||
return largestFile.name;
|
||||
}
|
||||
|
||||
export function torrentDisplayName(torrentDetails: TorrentDetails): string {
|
||||
return torrentDetails.name ?? getLargestFileName(torrentDetails);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue