diff --git a/src/wordpress_markdown_blog_loader/api.py b/src/wordpress_markdown_blog_loader/api.py index 5a05807..20686ee 100644 --- a/src/wordpress_markdown_blog_loader/api.py +++ b/src/wordpress_markdown_blog_loader/api.py @@ -338,11 +338,12 @@ def get_unique_user_by_name(self, name: str, email: Optional[str]) -> "User": if len(users) == 0: raise ValueError(f"author '{name}' not found on {self.endpoint.host}") elif len(users) > 1: - user = next(filter(lambda u: email and u.email == email, users), None) + user = next(filter(lambda u: email and u.email.lower() == email.lower(), users), None) if not user: raise ValueError( - f"Multiple authors named '{name}' found, none with email {email}" + f"Multiple authors named '{name}' found, none with email {email} (possible: { {u.email for u in users} })." ) + return user return users[0] def posts(self, query: dict = None) -> Iterator["Post"]: @@ -546,4 +547,4 @@ def get_tag_id_by_name(self, tag: str) -> str: "invalid tag '{}' try one of\n {}".format( tag, ",\n ".join(self.tags.keys()) ) - ) \ No newline at end of file + )