From 711776484dc0ab44ad01c4caaec8f39d78d8257f Mon Sep 17 00:00:00 2001 From: Trim21 Date: Fri, 29 Sep 2023 11:40:06 +0800 Subject: [PATCH 1/2] LinkedText: fix torrent comment line break (#667) --- .../components/general/LinkedText.tsx | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/client/src/javascript/components/general/LinkedText.tsx b/client/src/javascript/components/general/LinkedText.tsx index a49ccdb3a..b0f4b1458 100644 --- a/client/src/javascript/components/general/LinkedText.tsx +++ b/client/src/javascript/components/general/LinkedText.tsx @@ -18,15 +18,19 @@ function isValidHttpUrl(s: string) { } const LinkedText: FC = ({text, className}: LinkedTextProps) => { - const nodes = text.split(/\s/).map((s) => - isValidHttpUrl(s.trimEnd()) ? ( - - {s} - - ) : ( - s - ), - ); + const nodes = text.split(/([ \n])/).map((s) => { + if (s === '\n') { + return
; + } + if (isValidHttpUrl(s)) { + return ( + + {s} + + ); + } + return s; + }); return {nodes}; }; From 1192e14294734e3d8925da4b376e31bcc7b3fcac Mon Sep 17 00:00:00 2001 From: Trim21 Date: Wed, 18 Oct 2023 06:17:42 +0800 Subject: [PATCH 2/2] TorrentGeneralInfo: drop leading and trailing whitespaces from comment (#674) --- .../modals/torrent-details-modal/TorrentGeneralInfo.tsx | 2 +- .../rTorrent/constants/methodCallConfigs/torrentList.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx b/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx index 5840477ac..e700eafb1 100644 --- a/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx +++ b/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx @@ -207,7 +207,7 @@ const TorrentGeneralInfo: FC = observer(() => { - {torrent.comment ? : VALUE_NOT_AVAILABLE} + {torrent.comment ? : VALUE_NOT_AVAILABLE} diff --git a/server/services/rTorrent/constants/methodCallConfigs/torrentList.ts b/server/services/rTorrent/constants/methodCallConfigs/torrentList.ts index da7938f97..be4436f89 100644 --- a/server/services/rTorrent/constants/methodCallConfigs/torrentList.ts +++ b/server/services/rTorrent/constants/methodCallConfigs/torrentList.ts @@ -22,7 +22,7 @@ const torrentListMethodCallConfigs = { methodCall: 'd.custom2=', transformValue: (value: unknown): string => { // ruTorrent sets VRS24mrkr as a comment prefix, so we use it as well for compatability - if (value === '' || typeof value !== 'string' || value.indexOf('VRS24mrker') !== 0) { + if (value === '' || typeof value !== 'string' || !value.startsWith('VRS24mrker')) { return ''; }