@@ -150,6 +150,9 @@ fn fix_twitter_links_in_place(
150150 continue ;
151151 }
152152
153+ // Strip query params, muahahahaha
154+ parsed_url. set_query ( None ) ;
155+
153156 new_message_content. replace_range ( link_info. start ( ) ..link_info. end ( ) , parsed_url. as_str ( ) ) ;
154157 }
155158 new_message_content
@@ -163,9 +166,9 @@ mod tests {
163166 fn test_fix_twitter_links_in_place ( ) {
164167 let original_message = r#"
165168 This is a message that contains a twitter link (https://twitter.com/test/test), a
166- x.com link (https://x.com/test/test), a mobile.twitter.com link
167- (https://mobile.twitter.com/test/test), a mobile.x.com link
168- (https://mobile.x.com/test/test), an unrelated link
169+ x.com link (https://x.com/test/test?s=32&t=TcMWABOBcTGBg043O95RnL),
170+ a mobile.twitter.com link (https://mobile.twitter.com/test/test),
171+ a mobile.x.com link (https://mobile.x.com/test/test), an unrelated link
169172 (https://otherwebsite/test/test), and a weird twitter link
170173 (https://weird.link.twitter.com/test/test).
171174 "# ;
@@ -176,9 +179,9 @@ mod tests {
176179 new_message,
177180 r#"
178181 This is a message that contains a twitter link (https://fxtwitter.com/test/test), a
179- x.com link (https://fixupx.com/test/test), a mobile.twitter.com link
180- (https://fxtwitter.com/test/test), a mobile.x.com link
181- (https://fixupx.com/test/test), an unrelated link
182+ x.com link (https://fixupx.com/test/test),
183+ a mobile.twitter.com link (https://fxtwitter.com/test/test),
184+ a mobile.x.com link (https://fixupx.com/test/test), an unrelated link
182185 (https://otherwebsite/test/test), and a weird twitter link
183186 (https://weird.link.twitter.com/test/test).
184187 "#
0 commit comments