Explicitly deny bad URLs.

Fixes #252.
Handle embed untrusted links better.
This commit is contained in:
Paul
2021-09-25 10:54:32 +01:00
parent f5d66de999
commit 26be8e66c0
5 changed files with 26 additions and 22 deletions

View File

@@ -4,12 +4,16 @@ import { dispatch } from "../../../redux";
import Modal from "../../../components/ui/Modal";
import { useIntermediate } from "../Intermediate";
interface Props {
onClose: () => void;
link: string;
}
export function ExternalLinkModal({ onClose, link }: Props) {
const { openLink } = useIntermediate();
return (
<Modal
visible={true}
@@ -18,7 +22,7 @@ export function ExternalLinkModal({ onClose, link }: Props) {
actions={[
{
onClick: () => {
window.open(link, "_blank", "noreferrer");
openLink(link);
onClose();
},
confirmation: true,
@@ -40,7 +44,8 @@ export function ExternalLinkModal({ onClose, link }: Props) {
domain: url.hostname,
});
} catch (e) {}
window.open(link, "_blank", "noreferrer");
openLink(link);
onClose();
},
plain: true,