1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-06 16:46:30 +02:00

fix(senscritique) (#3750)

This commit is contained in:
Dag
2023-10-13 11:24:22 +02:00
committed by GitHub
parent 49d9dafaec
commit 920d00480d
5 changed files with 28 additions and 35 deletions

View File

@@ -7,7 +7,9 @@ final class UrlException extends \Exception
}
/**
* Intentionally restrictive url parser
* Intentionally restrictive url parser.
*
* Only absolute http/https urls.
*/
final class Url
{
@@ -29,7 +31,7 @@ final class Url
$parts = parse_url($url);
if ($parts === false) {
throw new UrlException(sprintf('Invalid url %s', $url));
throw new UrlException(sprintf('Failed to parse_url(): %s', $url));
}
return (new self())
@@ -38,6 +40,7 @@ final class Url
->withPort($parts['port'] ?? 80)
->withPath($parts['path'] ?? '/')
->withQueryString($parts['query'] ?? null);
// todo: add fragment
}
public static function validate(string $url): bool