allow ~ within urls

This commit is contained in:
Jörg Breitbart
2022-12-08 17:50:55 +01:00
parent e70138b63c
commit f69f9decca
@@ -12,12 +12,12 @@ import { ILinkProviderOptions, WebLinkProvider } from './WebLinkProvider';
// resembling the old (...)*([^:"\'\\s]) final path clause // resembling the old (...)*([^:"\'\\s]) final path clause
// additionally exclude early + final: // additionally exclude early + final:
// - unsafe from rfc3986: !*'() // - unsafe from rfc3986: !*'()
// - unsafe chars from rfc1738: {}|\^~[]` (minus [] as we need them for ipv6 adresses) // - unsafe chars from rfc1738: {}|\^~[]` (minus [] as we need them for ipv6 adresses, also allow ~)
// also exclude as finals: // also exclude as finals:
// - final interpunction like ,.!? // - final interpunction like ,.!?
// - any sort of brackets <>()[]{} (not spec conform, but often used to enclose urls) // - any sort of brackets <>()[]{} (not spec conform, but often used to enclose urls)
// - unsafe chars from rfc1738: {}|\^~[]` // - unsafe chars from rfc1738: {}|\^~[]`
const strictUrlRegex = /https?:[/]{2}[^\s"'!*(){}|\\\^~<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/; const strictUrlRegex = /https?:[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;
function handleLink(event: MouseEvent, uri: string): void { function handleLink(event: MouseEvent, uri: string): void {