File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
server/plugins/com.msgbyte.linkmeta/web/plugins/com.msgbyte.linkmeta/src Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
- import { regMessageExtraParser , regInspectService } from '@capital/common' ;
1
+ import {
2
+ regMessageExtraParser ,
3
+ regInspectService ,
4
+ getMessageTextDecorators ,
5
+ } from '@capital/common' ;
2
6
import { Translate } from './translate' ;
3
7
import urlRegex from 'url-regex' ;
4
8
import React from 'react' ;
@@ -7,9 +11,13 @@ import { UrlMetaPreviewer } from './UrlMetaPreviewer';
7
11
regMessageExtraParser ( {
8
12
name : 'com.msgbyte.linkmeta/urlParser' ,
9
13
render ( { content } ) {
10
- const matched = String ( content ) . match ( urlRegex ( ) ) ;
14
+ const matched = String (
15
+ getMessageTextDecorators ( ) . serialize ( String ( content ) )
16
+ ) . match ( urlRegex ( ) ) ;
11
17
if ( matched ) {
12
- const urlMatch = matched . filter ( ( m ) => ! m . includes ( '[' ) ) ;
18
+ const urlMatch = matched
19
+ . filter ( ( m ) => ! m . includes ( '[' ) )
20
+ . filter ( ( m ) => ! m . startsWith ( window . location . origin ) ) ;
13
21
14
22
if ( urlMatch . length > 0 && typeof urlMatch [ 0 ] === 'string' ) {
15
23
return < UrlMetaPreviewer url = { urlMatch [ 0 ] } /> ;
You can’t perform that action at this time.
0 commit comments