File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -79,10 +79,10 @@ def decode(self, encoded_packet):
79
79
self .data = None
80
80
ep = ep [1 :]
81
81
dash = ep .find ('-' )
82
- if dash > 10 :
83
- raise ValueError ('too many attachments' )
84
82
attachment_count = 0
85
83
if dash > 0 and ep [0 :dash ].isdigit ():
84
+ if dash > 10 :
85
+ raise ValueError ('too many attachments' )
86
86
attachment_count = int (ep [0 :dash ])
87
87
ep = ep [dash + 1 :]
88
88
if ep and ep [0 :1 ] == '/' :
Original file line number Diff line number Diff line change @@ -261,7 +261,12 @@ def test_decode_too_many_binary_packets(self):
261
261
262
262
def test_decode_attachment_count_too_long (self ):
263
263
with pytest .raises (ValueError ):
264
- packet .Packet (encoded_packet = '6' + ('1' * 11 ) + '-{"a":"123}' )
264
+ packet .Packet (encoded_packet = '6' + ('1' * 11 ) + '-{"a":"123"}' )
265
+
266
+ def test_decode_dash_in_payload (self ):
267
+ pkt = packet .Packet (encoded_packet = '6{"a":"0123456789-"}' )
268
+ assert pkt .data ["a" ] == "0123456789-"
269
+ assert pkt .attachment_count == 0
265
270
266
271
def test_data_is_binary_list (self ):
267
272
pkt = packet .Packet ()
You can’t perform that action at this time.
0 commit comments