Update server.py

This commit is contained in:
Nova Cat 2025-01-13 21:54:37 -08:00
parent 81dd648e35
commit a33e4fef5a

View file

@ -50,13 +50,14 @@ def relay():
elif num >= 2 and not mimetype in ["text/gemini", ""]:
for i in gemresponse:
gemraw.append(i)
if gemresponse.decode() != "":
if mimetype in ["text/gemini", ""] and gemresponse.decode() != "":
received += gemresponse.decode()
else:
break
num+=1
except:
return f'<!DOCTYPE html>\n<html><head><meta charset="UTF-8"><link rel="stylesheet" href="/style.css"><title>Something went wrong...</title></head><body><h1>Something went wrong...</h1><p>The file that the Gemini server sent couldn\'t be decoded by Gem2Browser.</p></body></html>'
print(mimetype)
if not mimetype.lower() in ["text/gemini", ""]:
return bytes(gemraw)
received = received.replace("\r", "")