diff options
| author | Zeyla Hellyer <[email protected]> | 2017-12-09 09:38:05 -0800 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-12-09 09:42:46 -0800 |
| commit | 594d3d2e047f406a2b2243c0e1f023df590b182a (patch) | |
| tree | 7f25b0dc6dcb8df9e879c483e9db9484e32df816 /src/model/mod.rs | |
| parent | Fall back to `str::parse` on `ChannelId` as well (diff) | |
| download | serenity-594d3d2e047f406a2b2243c0e1f023df590b182a.tar.xz serenity-594d3d2e047f406a2b2243c0e1f023df590b182a.zip | |
Fix snowflake deserializer
Fixes snowflake deserializers (ChannelId, UserId, etc.) by switching
from a usage of `deserialize_u64` to `deserialize_any`.
Our usage of `deserialize_u64` was incorrect and the erroneous behaviour
was fixed in serde_json v1.0.8. We were essentially telling serde that
the received type was a u64, when in fact it can be multiple types
(strings, u64, or an i64 just in case).
This resulted in errors like:
```
Client error: Json(ErrorImpl { code: Message("invalid type: string
\"317727377985634305\", expected identifier"), line: 1, column: 100 })
```
Due to this, simple operations such as even connecting a client failed.
(cherry picked from commit 77f462ea2044ef7d2d12fd1289ea75a6a33cb5dd)
Diffstat (limited to 'src/model/mod.rs')
| -rw-r--r-- | src/model/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/model/mod.rs b/src/model/mod.rs index 83ecafa..7a7a007 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -97,7 +97,7 @@ macro_rules! id_u64 { impl<'de> Deserialize<'de> for $name { fn deserialize<D: Deserializer<'de>>(deserializer: D) -> StdResult<Self, D::Error> { - deserializer.deserialize_u64(U64Visitor).map($name) + deserializer.deserialize_any(U64Visitor).map($name) } } )* |