Skip to content

Commit

Permalink
Merge pull request #1646 from FerFerMe/x.com
Browse files Browse the repository at this point in the history
Add support for x.com in TWEET_RE regex
  • Loading branch information
davidmz authored Sep 3, 2023
2 parents e365cc4 + 94a0730 commit b863b09
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
parses in texts as active links.
- Old-fashion links, with long UIDs, are still fully supported.

- Updated TWEET_RE regex to support matching x.com in addition to twitter.com.

### Changed
- Spoiler tag can now contain line feeds. In addition, user text formatting
utilizes simpler HTML, with fewer wrappers. Visually, the output for the user
Expand Down
2 changes: 1 addition & 1 deletion src/components/link-preview/twitter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { withEventListener } from '../hooks/sub-unsub';
import * as heightCache from './helpers/size-cache';
import FoldableContent from './helpers/foldable-content';

const TWEET_RE = /^https?:\/\/twitter\.com\/[^/]+\/status\/(\d+)/i;
const TWEET_RE = /^https?:\/\/(?:twitter|x)\.com\/[^/]+\/status\/(\d+)/i;

export function canShowURL(url) {
return TWEET_RE.test(url);
Expand Down

0 comments on commit b863b09

Please sign in to comment.