You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a BSON map containing well-formed binary values, e.g. <<18, 0, 0, 0, 5, 118, 0, 5, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0>>, is passed to Cyanide 2.0 decode/1 (resulting in %{"v" => %Cyanide.Binary{subtype: :generic, data: <<1, 2, 3, 4, 5>>}} and then to Astarte.Core.Mapping.ValueType.validate_value/1, the function returns {:error, :unexpected_value_type} instead of the correct :ok.
This happens because the function body pattern-matches on the tuple {_subtype, bin} rather than on a %Cyanide.Binary{} struct, see here:
To fix this, the correct Cyanide.Binary{subtype: _subtype, data: binary} struct should be used.
The change happened when switching to the 2.0.0 version of Cyanide, i.e. starting from the release-1.1 branch.
The text was updated successfully, but these errors were encountered:
When a BSON map containing well-formed binary values, e.g.
<<18, 0, 0, 0, 5, 118, 0, 5, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0>>
, is passed to Cyanide 2.0decode/1
(resulting in%{"v" => %Cyanide.Binary{subtype: :generic, data: <<1, 2, 3, 4, 5>>}}
and then toAstarte.Core.Mapping.ValueType.validate_value/1
, the function returns{:error, :unexpected_value_type}
instead of the correct:ok
.This happens because the function body pattern-matches on the tuple
{_subtype, bin}
rather than on a%Cyanide.Binary{}
struct, see here:astarte_core/lib/astarte_core/mapping/value_type.ex
Lines 188 to 193 in 670a8c2
To fix this, the correct
Cyanide.Binary{subtype: _subtype, data: binary}
struct should be used.The change happened when switching to the 2.0.0 version of Cyanide, i.e. starting from the release-1.1 branch.
The text was updated successfully, but these errors were encountered: