Skip to content

Commit 8276fd8

Browse files
authored
lowercase email compare
When multiple users are found, do email check case-insensitive. Also when not found, log the found email address as a set.
1 parent a34b6b9 commit 8276fd8

File tree

1 file changed

+3
-3
lines changed
  • src/wordpress_markdown_blog_loader

1 file changed

+3
-3
lines changed

src/wordpress_markdown_blog_loader/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ def get_unique_user_by_name(self, name: str, email: Optional[str]) -> "User":
338338
if len(users) == 0:
339339
raise ValueError(f"author '{name}' not found on {self.endpoint.host}")
340340
elif len(users) > 1:
341-
user = next(filter(lambda u: email and u.email == email, users), None)
341+
user = next(filter(lambda u: email and u.email.lower() == email.lower(), users), None)
342342
if not user:
343343
raise ValueError(
344-
f"Multiple authors named '{name}' found, none with email {email}"
344+
f"Multiple authors named '{name}' found, none with email {email} (possible: { {u.email for u in users} })."
345345
)
346346
return users[0]
347347

@@ -546,4 +546,4 @@ def get_tag_id_by_name(self, tag: str) -> str:
546546
"invalid tag '{}' try one of\n {}".format(
547547
tag, ",\n ".join(self.tags.keys())
548548
)
549-
)
549+
)

0 commit comments

Comments
 (0)