Skip to content

Commit

Permalink
fix(user/find): match anonymous emails
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 6, 2024
1 parent 6e45b13 commit f2a4e82
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion routes/users/find/[query].ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import type { GithubUser } from "~types";

const anonEmailRegex = /^\d+\+(.+)@users.noreply.github.com$/;

export default eventHandler(async (event) => {
let query = event.context.params.query + '';

const anonMatch = query.match(anonEmailRegex);
if (anonMatch) {
query = anonMatch[1];
}

const res = await ghFetch("/search/users", {
params: { q: event.context.params.query },
params: { q: query },
});

if (res.items.length === 0) {
Expand Down

0 comments on commit f2a4e82

Please sign in to comment.