sanitizing urls

This commit is contained in:
Roland Osborne 2023-04-03 12:27:45 -07:00
parent b0b5c19754
commit 2def0c1ee2
3 changed files with 8 additions and 2 deletions

View File

@ -10,6 +10,7 @@
"test": "jest"
},
"dependencies": {
"@braintree/sanitize-url": "^6.0.2",
"@react-native-clipboard/clipboard": "^1.11.1",
"@react-native-firebase/app": "^17.2.0",
"@react-native-firebase/messaging": "^17.2.0",

View File

@ -9,7 +9,7 @@ import { useWindowDimensions, Text } from 'react-native';
import Colors from 'constants/Colors';
import { getCardByGuid } from 'context/cardUtil';
import { decryptTopicSubject } from 'context/sealUtil';
import * as DOMPurify from 'dompurify';
import { sanitizeUrl } from '@braintree/sanitize-url';
export function useTopicItem(item, hosting, remove, contentKey) {
@ -214,7 +214,7 @@ export function useTopicItem(item, hosting, remove, contentKey) {
if (!!pattern.test(word)) {
clickable.push(<Text key={index}>{ group }</Text>);
group = '';
clickable.push(<Text key={'link-' + index} onPress={() => Linking.openURL(word)} style={{ fontStyle: 'italic' }}>{ word + ' ' }</Text>);
clickable.push(<Text key={'link-' + index} onPress={() => Linking.openURL(sanitizeUrl(word))} style={{ fontStyle: 'italic' }}>{ sanitizeUrl(word) + ' ' }</Text>);
}
else {
group += `${word} `;

View File

@ -1077,6 +1077,11 @@
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@braintree/sanitize-url@^6.0.2":
version "6.0.2"
resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-6.0.2.tgz#6110f918d273fe2af8ea1c4398a88774bb9fc12f"
integrity sha512-Tbsj02wXCbqGmzdnXNk0SOF19ChhRU70BsroIi4Pm6Ehp56in6vch94mfbdQ17DozxkL3BAVjbZ4Qc1a0HFRAg==
"@egjs/hammerjs@^2.0.17":
version "2.0.17"
resolved "https://registry.npmjs.org/@egjs/hammerjs/-/hammerjs-2.0.17.tgz"