Fix rare issue with malformed expanded link data

This commit is contained in:
dangered wolf 2024-05-21 00:02:45 -04:00
parent 9a9ca5381e
commit eb565e689a
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58

View file

@ -5,7 +5,7 @@ export const linkFixer = (entities: TcoExpansion[] | undefined, text: string): s
// });
if (Array.isArray(entities) && entities.length) {
entities.forEach((url: TcoExpansion) => {
let newURL = url.expanded_url;
let newURL = url.expanded_url ?? url.url ?? '';
if (newURL.match(/^https:\/\/twitter\.com\/i\/web\/status\/\w+/g) !== null) {
newURL = '';