Skip to content

Commit

Permalink
Merge branch 'master' into upgrade-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 authored Nov 15, 2023
2 parents 55a9e5b + 1192e14 commit 22e1876
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
22 changes: 13 additions & 9 deletions client/src/javascript/components/general/LinkedText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ function isValidHttpUrl(s: string) {
}

const LinkedText: FC<LinkedTextProps> = ({text, className}: LinkedTextProps) => {
const nodes = text.split(/\s/).map((s) =>
isValidHttpUrl(s.trimEnd()) ? (
<a href={s.trimEnd()} target="_blank" rel="noopener noreferrer">
{s}
</a>
) : (
s
),
);
const nodes = text.split(/([ \n])/).map((s) => {
if (s === '\n') {
return <br />;
}
if (isValidHttpUrl(s)) {
return (
<a href={s.trimEnd()} target="_blank" rel="noopener noreferrer">
{s}
</a>
);
}
return s;
});

return <span className={className}>{nodes}</span>;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const TorrentGeneralInfo: FC = observer(() => {
<Trans id="torrents.details.general.comment" />
</td>
<td className="torrent-details__detail__value">
{torrent.comment ? <LinkedText text={torrent.comment} /> : VALUE_NOT_AVAILABLE}
{torrent.comment ? <LinkedText text={torrent.comment.trim()} /> : VALUE_NOT_AVAILABLE}
</td>
</tr>
<tr className="torrent-details__table__heading">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
}

Expand Down

0 comments on commit 22e1876

Please sign in to comment.