diff --git a/post.php b/post.php index 27a45413..8f229135 100644 --- a/post.php +++ b/post.php @@ -953,7 +953,11 @@ function handle_post(Context $ctx) // Check for an embed field if ($config['enable_embedding'] && isset($_POST['embed']) && !empty($_POST['embed'])) { // yep; validate it - $value = $_POST['embed']; + $value = \trim($_POST['embed']); + if (\filter_var($value, \FILTER_VALIDATE_URL) === false) { + error($config['error']['invalid_embed']); + } + foreach ($config['embedding'] as &$embed) { if (preg_match($embed[0], $value)) { // Valid link