File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
lib/active_support/message_pack Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ def load(dumped)
25
25
end
26
26
27
27
def signature? ( dumped )
28
- dumped . start_with? ( SIGNATURE )
28
+ dumped . getbyte ( 0 ) == SIGNATURE . getbyte ( 0 ) && dumped . getbyte ( 1 ) == SIGNATURE . getbyte ( 1 )
29
29
end
30
30
31
31
def message_pack_factory
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ module MessagePackSharedSerializerTests
41
41
assert_not serializer . signature? ( "{}" )
42
42
end
43
43
44
+ test "#signature? handles non-ASCII-only non-binary-encoded strings" do
45
+ assert serializer . signature? ( dump ( "ümlaut" ) . force_encoding ( Encoding ::UTF_8 ) )
46
+ assert_not serializer . signature? ( "ümlaut" )
47
+ end
48
+
44
49
test "roundtrips Symbol" do
45
50
assert_roundtrip :some_symbol
46
51
end
You can’t perform that action at this time.
0 commit comments