mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-12 15:01:38 +03:00
chat: strictly match URLs in outgoing strings
Our regex processes true, and sends a message as a URL, if any part of the string is a URL starting with a URI schema. We pass this function strings cut up by spaces. If a link was enclosed in quotes, or in brackets, this would still process as true. This adds ^ to the regex to only process strings that START with a schema.
This commit is contained in:
parent
3196179fbd
commit
5b45ad986d
@ -173,7 +173,7 @@ export class ChatInput extends Component {
|
||||
|
||||
isUrl(string) {
|
||||
try {
|
||||
const websiteTest = new RegExp(String(/((\w+:\/\/)[-a-zA-Z0-9:@;?&=\/%\+\.\*!'\(\),\$_\{\}\^~\[\]`#|]+)/.source)
|
||||
const websiteTest = new RegExp(String(/^((\w+:\/\/)[-a-zA-Z0-9:@;?&=\/%\+\.\*!'\(\),\$_\{\}\^~\[\]`#|]+)/.source)
|
||||
);
|
||||
return websiteTest.test(string);
|
||||
} catch (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user