From c0cbe41c42e7294ddd021d443fc6dc8fd0779002 Mon Sep 17 00:00:00 2001 From: n Date: Sun, 20 Feb 2022 14:36:24 +0100 Subject: [PATCH] fix filenames generation --- blog/index.gen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blog/index.gen.py b/blog/index.gen.py index 87675a3..d7fd162 100755 --- a/blog/index.gen.py +++ b/blog/index.gen.py @@ -32,6 +32,7 @@ mydb = mysql.connector.connect( mycursor = mydb.cursor() mycursor.execute("SELECT post_url, post_title, post_content_xhtml FROM dc_post WHERE post_url LIKE '%/%/%/%' ORDER BY post_id DESC") myresult = mycursor.fetchall() +mydb.close() f = open("index.gmi", "w") f.write("# Tourmentine's blog-to-gemlog\n\n"); @@ -42,7 +43,7 @@ for x in myresult: filename = filename_regex.findall(x[0])[0] f = open("index.gmi", "a") - f.write("=> %s/%s.gmi %s - %s\n" % (path, filename, path.replace("/","-"), x[1])) + f.write("=> %s/%s.gmi %s - %s\n" % (path, quote(quote(filename)), path.replace("/","-"), x[1])) f.close() try: -- 2.40.1