Improved sanitization of href's in editor
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
export default function isUrl(text: string) {
|
||||
if (text.match(/\n/)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
const url = new URL(text);
|
||||
return url.hostname !== "";
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user