Skip to content

Commit

Permalink
Merge branch 'master' into feat/death-message
Browse files Browse the repository at this point in the history
  • Loading branch information
11k committed Dec 31, 2023
2 parents 63b32bd + 67fa2d4 commit 0d17cb4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions assets/chat/js/formatters/UrlFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,16 @@ export default class UrlFormatter {
return url.split('?')[0];
}

if (/youtu(?:be\.com|\.be)/i.test(url)) {
if (/^(?:(?:https|http):\/\/)?(?:www\.)?youtu(?:be\.com|\.be)/i.test(url)) {
// Same as with xeets, remove the nasty share tracking query param
// from YouTube links.
const ytLink = new URL(url);
ytLink.searchParams.delete('si');
return ytLink.href;
try {
const ytLink = new URL(url);
ytLink.searchParams.delete('si');
return ytLink.href;
} catch {
return url;
}
}

return url;
Expand Down

0 comments on commit 0d17cb4

Please sign in to comment.