kopia lustrzana https://github.com/wagtail/wagtail
Fix link paste detection concatenating URLs. Fix #12393
rodzic
78845c74f0
commit
9f9d177cc8
|
@ -70,6 +70,12 @@ export const getValidLinkURL = (text, schemes) => {
|
|||
}
|
||||
}
|
||||
|
||||
// If there is whitespace, treat text as not a URL.
|
||||
// Prevents scenarios like `URL.parse('https://test.t/ http://a.b/')`.
|
||||
if (/\s/.test(text)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
const url = new URL(text);
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@ describe.each`
|
|||
${'http://test.example.co.uk'} | ${'http://test.example.co.uk'}
|
||||
${'https://example.com'} | ${'https://example.com'}
|
||||
${'https://xn--ls8h.la'} | ${'https://xn--ls8h.la'}
|
||||
${'http://sp.a http://c.e'} | ${false}
|
||||
${'ftp://example.com'} | ${'ftp://example.com'}
|
||||
${'ftps://example.com'} | ${'ftps://example.com'}
|
||||
${'//example.com'} | ${false}
|
||||
|
|
Ładowanie…
Reference in New Issue