Skip to content
New issue

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

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

Already on GitHub? # to your account

Don't attempt to convert integers to atoms in map casting #572

Merged
merged 1 commit into from
May 3, 2024

Conversation

jb3
Copy link
Collaborator

@jb3 jb3 commented May 3, 2024

This fixes a bug reported in the DAPI channel which caused the Shard state machine to crash out with an error.

Discord has started sending some maps with integer keys for interactions payloads. We previously handled snowflake payloads (although these payloads used string keys anyway).

This PR:

  • Checks whether Nostrum.Util.maybe_to_atom/1 is receiving an integer, if so, just return that integer.
  • Extend the existing snowflake casting check to include 0, that way we return maps that are indexed with 0 instead of :"0" (cursed!)

@jb3 jb3 merged commit 7fb0515 into master May 3, 2024
9 checks passed
@jb3 jb3 deleted the jb3/integer-indexed-map-fixes branch May 3, 2024 00:59
@jb3
Copy link
Collaborator Author

jb3 commented May 3, 2024

Thanks!

@jchristgit
Copy link
Collaborator

jchristgit commented May 3, 2024 via email

@broman
Copy link

broman commented May 3, 2024

Epic commit bro! Wow!

@jb3
Copy link
Collaborator Author

jb3 commented May 3, 2024

Team, thanks!

@broman
Copy link

broman commented May 3, 2024

i love nostrum

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants