Update server.py

This commit is contained in:
Nova Cat 2025-01-14 15:42:03 -08:00
parent d7228ccc13
commit 8a19ff1828

View file

@ -46,18 +46,17 @@ def relay():
else: else:
break break
found = False found = False
gemraw = bytes(gemraw)
gemcontent_binary = bytearray() gemcontent_binary = bytearray()
mtype = bytearray() mtype = bytearray()
for i in gemraw: for i in bytes(gemraw):
try: try:
if not found: if not found:
mtype += i mtype += i
else:
gemcontent_binary += i
if "\n" in bytes(mtype).decode() and not found: if "\n" in bytes(mtype).decode() and not found:
ok = bytes(mtype).decode().split(" ")[0][0] == "2" ok = bytes(mtype).decode().split(" ")[0][0] == "2"
mimetype = bytes(mtype).decode().split(" ")[1].split(";")[0] mimetype = bytes(mtype).decode().split(" ")[1].split(";")[0]
elif found:
gemcontent_binary += i
except: except:
binary = True binary = True
print(traceback.format_exc()) print(traceback.format_exc())