Skip to content

Commit b76b27c

Browse files
committed
When displaying expanded URLs, ignore request parameters
1 parent 6dad6bd commit b76b27c

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

desktop/src/main/scala/org/talkingpuffin/ui/TweetDetailPanel.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ class TweetDetailPanel(session: Session,
125125
}.peer)
126126
}
127127

128-
private def getFiltersDialog: Option[FiltersDialog] = None
129-
130128
private def showStatusDetails(userAndStatus: UserAndStatus, filtersDialog: Option[FiltersDialog]) {
131129
session.clearMessage()
132130
setText(userAndStatus.origUser, userAndStatus.status)
@@ -142,9 +140,11 @@ class TweetDetailPanel(session: Session,
142140
userAndStatus.retweetingUser))
143141

144142
if (GlobalPrefs.isOn(PrefKeys.EXPAND_URLS)) {
145-
def replaceUrl(shortUrl: String, fullUrl: String) = {
143+
def urlWithoutRequestParams(url: String) = url.split("\\?")(0)
144+
145+
def replaceUrl(shortUrl: String, fullUrl: String) {
146146
val beforeText = largeTweet.getText
147-
val afterText = beforeText.replace(shortUrl, fullUrl)
147+
val afterText = beforeText.replace(shortUrl, urlWithoutRequestParams(fullUrl))
148148
if (beforeText != afterText) {
149149
largeTweet setText afterText
150150
largeTweet setCaretPosition 0

desktop/src/main/scala/org/talkingpuffin/util/ShortUrl.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,10 @@ object ShortUrl extends Loggable {
4949
val matcher = LinkExtractor.hyperlinkPattern.matcher(text)
5050
while (matcher.find) {
5151
val sourceUrl = matcher.group(1)
52-
expandUrl(sourceUrl, (targetUrl: String) => {provideSourceAndTargetUrl(sourceUrl, targetUrl)})
52+
expandUrl(sourceUrl, (targetUrl: String) => provideSourceAndTargetUrl(sourceUrl, targetUrl))
5353
}
5454
}
5555

5656
private def urlIsShortened(url: String) = shortenerHosts.exists(url.contains(_)) ||
5757
shortenerRegexes.exists(r => url match {case r() => true case _ => false})
58-
5958
}

0 commit comments

Comments
 (0)