diff --git a/server.py b/server.py index c19a26f..cec934e 100644 --- a/server.py +++ b/server.py @@ -63,6 +63,27 @@ def relay(): except: return f'\nSomething went wrong...

Something went wrong...

The file that the Gemini server sent couldn\'t be decoded by Gem2Browser.

' print(mimetype) + mimetyp = "" + for i in bytes(gemraw): + try: + if i.decode() != "\r": + mimetyp += i.decode() + else: + break + except: + break + mimetype = mimetyp + gr2 = bytearray() + if not mimetype in ["text/gemini", ""]: + frline = True + for i in gemraw: + try: + if frline and i.decode() != "\n": + pass + else: + frline = False + except: + pass if binary: return Response(bytes(gemraw), mimetype="text/gemini" if mimetype=="" else mimetype) received = received.replace("\r", "")