Skip to content

Commit

Permalink
avoid path separators in hashed file path for upload
Browse files Browse the repository at this point in the history
fixes #63
  • Loading branch information
tridge committed Oct 6, 2024
1 parent c6706de commit b4ceba6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dronecan_gui_tool/widgets/file_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ def FileServer_PathKey(path):
return key used in file read request for a path. This is kept to 7 bytes
to keep the read request in 2 frames
'''
return base64.b64encode(struct.pack("<I",zlib.crc32(bytearray(path,'utf-8'))))[:7].decode('utf-8')
ret = base64.b64encode(struct.pack("<I",zlib.crc32(bytearray(path,'utf-8'))))[:7].decode('utf-8')
# avoid path separators
ret = ret.replace('/','_').replace('\\','_')
return ret

class PathItem(QWidget):
def __init__(self, parent, default=None):
Expand Down

0 comments on commit b4ceba6

Please sign in to comment.