File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change
1
+ import { localize } from '../../i18n'
1
2
import { INft } from '../interfaces'
2
3
3
4
/**
@@ -10,10 +11,13 @@ export function isFlaggedNft(nft: INft): string | undefined {
10
11
const parsedMetadata = nft . parsedMetadata
11
12
const parsedName = parsedMetadata ?. name ?? ''
12
13
const parsedDescription = parsedMetadata ?. description ?? ''
13
- const urlRegex = / ( ( h t t p s ? | f t p | f i l e ) : \/ \/ ) ? ( [ \d a - z - ] + \. ) + ( [ a - z ] { 2 , 6 } ) ( [ / \w . - ] * ) * \/ ? $ / gi
14
+ const urlRegex = new RegExp (
15
+ '\\b(?:https?:\\/\\/)?[a-zA-Z0-9-]+(?:[\\.\\u2024\\uFE52\\uFF0E\\uFF61][a-zA-Z0-9-]+)+\\b(?:[\\/\\?#][^\\s()<>]*)?' ,
16
+ 'i'
17
+ )
14
18
const containsUrl = urlRegex . test ( name ) || urlRegex . test ( parsedName ) || urlRegex . test ( parsedDescription )
15
- // Note: in order to avoid issues with the translations, we are using a hardcoded string here
16
- const WARNING_MESSAGE =
17
- 'Be careful when following unknown links. Never share your private keys, nor enter them into any websites or services. '
18
- return containsUrl ? WARNING_MESSAGE : undefined
19
+
20
+ if ( containsUrl ) {
21
+ return localize ( 'warning.nft.flagged' )
22
+ }
19
23
}
Original file line number Diff line number Diff line change 2127
2127
},
2128
2128
"participation" : {
2129
2129
"noFunds" : " You do not have any IOTA."
2130
+ },
2131
+ "nft" : {
2132
+ "flagged" : " Be careful when following unknown links. Never share your private keys, nor enter them into any websites or services."
2130
2133
}
2131
2134
},
2132
2135
"tooltips" : {
You can’t perform that action at this time.
0 commit comments