Skip to content

Commit bcd8db8

Browse files
committed
Fix mkdir when directory is top level
1 parent dfb0b4c commit bcd8db8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/ble_file_transfer_stub_server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""This example broadcasts out the creation id based on the CircuitPython machine
66
string and provides a stub FileTransferService."""
77

8+
import binascii
89
import struct
910
import os
1011

@@ -22,7 +23,7 @@
2223
service = FileTransferService()
2324
print(ble.name)
2425
advert = adafruit_ble_creation.Creation(creation_id=cid, services=[service])
25-
print(bytes(advert), len(bytes(advert)))
26+
print(binascii.hexlify(bytes(advert)), len(bytes(advert)))
2627

2728
CHUNK_SIZE = 4000
2829

@@ -250,7 +251,7 @@ def read_complete_path(starting_path, total_length):
250251
parent = stored_data
251252
i = 1
252253
ok = True
253-
while i < len(pieces) - 1 and ok:
254+
while i < len(pieces) and ok:
254255
piece = pieces[i]
255256
if piece not in parent:
256257
parent[piece] = {}
@@ -297,6 +298,7 @@ def read_complete_path(starting_path, total_length):
297298
contents = d[filename]
298299
if isinstance(contents, dict):
299300
flags = FileTransferService.DIRECTORY
301+
content_length = 0
300302
else:
301303
content_length = len(contents)
302304
header = struct.pack(

0 commit comments

Comments
 (0)