From 011f90cca67d0db5c9cd1f352a12051176ff933a Mon Sep 17 00:00:00 2001 From: swee Date: Tue, 14 Jan 2025 15:17:05 -0800 Subject: [PATCH] Update server.py --- server.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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", "")