Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while signing on using Discord if no avatar #1649 #1650

Merged
merged 4 commits into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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);

Check warning on line 137 in src/main/java/ai/elimu/web/SignOnControllerDiscord.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/ai/elimu/web/SignOnControllerDiscord.java#L137

Added line #L137 was not covered by tests
venkatesh2k3 marked this conversation as resolved.
Show resolved Hide resolved
venkatesh2k3 marked this conversation as resolved.
Show resolved Hide resolved
contributor.setImageUrl(uriAvatar);
}
if (jsonObject.has("username")) {
Expand Down Expand Up @@ -188,4 +188,4 @@
return "redirect:/content";
}
}
}
}
Loading