From 73f9d750b70368f2252714fd6af2371a4e93afe2 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 6 May 2020 12:39:58 -0500 Subject: [PATCH] Shorten link out URL's --- Frameworks/Account/FeedProvider/Reddit/RedditLink.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift b/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift index 3eb07f424..3b69f8020 100644 --- a/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift +++ b/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift @@ -122,7 +122,11 @@ struct RedditLinkData: Codable { guard !host.hasSuffix("reddit.com") && !host.hasSuffix("redd.it") else { return "" } - return "
\(url)
" + var displayURL = "\(urlComponents.host ?? "")\(urlComponents.path)" + if displayURL.count > 30 { + displayURL = "\(displayURL.prefix(30))..." + } + return "
\(displayURL)
" } }