From f2d221a2f0d19213e6670510b111682d546f3876 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Wed, 18 Aug 2021 06:53:37 +0300

Subject: [PATCH 1/1] GmRequest: Detect UTF-8 in local files of unknown type


src/gmutil.c | 41 +++++++++++++++++++++++++++--------------

1 file changed, 27 insertions(+), 14 deletions(-)

diff --git a/src/gmutil.c b/src/gmutil.c

index fda8489b..9bd74ee0 100644

--- a/src/gmutil.c

+++ b/src/gmutil.c

@@ -22,10 +22,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */

#include "gmutil.h"

-#include <the_Foundation/regexp.h>

+#include <the_Foundation/file.h>

+#include <the_Foundation/fileinfo.h>

#include <the_Foundation/object.h>

#include <the_Foundation/path.h>

#include <the_Foundation/regexp.h>

+#include <the_Foundation/regexp.h>

iRegExp *newGemtextLink_RegExp(void) {

 return new_RegExp("=>\\s*([^\\s]+)(\\s.*)?", 0);

@@ -513,18 +515,6 @@ const char *mediaType_Path(const iString *path) {

 if (endsWithCase_String(path, ".gmi") || endsWithCase_String(path, ".gemini")) {

     return "text/gemini; charset=utf-8";

 }

 else if (endsWithCase_String(path, ".pem")) {

     return "application/x-pem-file";

 }

@@ -558,7 +548,30 @@ const char *mediaType_Path(const iString *path) {

 else if (endsWithCase_String(path, ".mid")) {

     return "audio/midi";

 }

}

static void replaceAllChars_String_(iString *d, char c, const char *replacement) {

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.11/patch/f2d221a2f0d19213e6670510b111682d546f3876.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
59.706475 milliseconds
Gemini-to-HTML Time
1.674019 milliseconds

This content has been proxied by September (ba2dc).