throw error if url is empty

This commit is contained in:
Matthias Pfefferle 2024-07-15 23:18:40 +02:00
parent 4397ae95c8
commit b715d0f01b

View file

@ -126,6 +126,17 @@ class Webfinger {
* identifier and host as values
*/
public static function get_identifier_and_host( $url ) {
if ( ! $url ) {
return new WP_Error(
'webfinger_invalid_identifier',
__( 'Invalid Identifier', 'activitypub' ),
array(
'status' => 400,
'data' => $url,
)
);
}
// remove leading @
$url = ltrim( $url, '@' );