Skip to content

Commit

Permalink
Error while signing on using Discord if no avatar #1649 (#1650)
Browse files Browse the repository at this point in the history
Signing can do if there is no avatar
  • Loading branch information
venkatesh2k3 authored Jul 2, 2024
2 parents 4862d8d + 4e4d750 commit 0e3ec41
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/ai/elimu/web/SignOnControllerDiscord.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ public String handleCallback(HttpServletRequest request) throws IOException, Int
String id = String.valueOf(idAsLong);
contributor.setProviderIdDiscord(id);
}
if (jsonObject.has("avatar")) {
if (!jsonObject.isNull("avatar")) {
String uriAvatar = "https://cdn.discordapp.com/avatars/" + jsonObject.getLong("id") + "/" + jsonObject.getString("avatar") + ".png";
logger.info(uriAvatar);
logger.info("Avatar URL: " + uriAvatar);
contributor.setImageUrl(uriAvatar);
}
if (jsonObject.has("username")) {
Expand Down Expand Up @@ -188,4 +188,4 @@ public String handleCallback(HttpServletRequest request) throws IOException, Int
return "redirect:/content";
}
}
}
}

0 comments on commit 0e3ec41

Please sign in to comment.