Fully ensure all URL components are present for rewriting
This commit is contained in:
parent
ae12cfdf0f
commit
5c2c1a47cc
@ -203,7 +203,7 @@ final class MD_STD_IN {
|
||||
}
|
||||
}
|
||||
catch (MDInvalidUrl $e) {
|
||||
if (($parsed = parse_url($input)) === false || empty($parsed['scheme'])) {
|
||||
if (($parsed = parse_url($input)) === false || empty($parsed['scheme']) || empty($parsed['host']) || empty($parsed['path'])) {
|
||||
throw new MDInvalidUrl("Invalid input URL");
|
||||
}
|
||||
$rewritten = $parsed['scheme'] . '://';
|
||||
@ -219,6 +219,8 @@ final class MD_STD_IN {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($output)) return '';
|
||||
|
||||
// Check for valid schemes
|
||||
if (MD_STD::startsWithAny($output, ['https://', 'http://', 'ftp://']) === false) {
|
||||
throw new MDInvalidUrl("Invalid input URL");
|
||||
|
Loading…
Reference in New Issue
Block a user