Make title_id less buggy

When the title have ponctuation or finish by space it's cause bug when
you share the link ! We keep characteres alphanumeric  and replace space
by '-' character for index the article
This commit is contained in:
2026-09-03 03:38:43 +02:00
parent 434623f290
commit 787c23ee9b

View File

@@ -7,6 +7,7 @@ import sqlite3
from markdown import markdown
from tools.filesutils import getFileSizeKo
import string
import re
from shutil import copy
from tools.utils import login_required
@@ -35,7 +36,9 @@ def new_article():
user = '%s' % escape(session['username'])
if request.method == 'POST':
title_id = escape(request.form['title'].rstrip())
tmp = re.sub(r'[^a-zA-Z0-9 ]', '', request.form['title'].rstrip())
title_id = tmp.replace(' ', '-')
print("---------title_id : " + title_id)
title = request.form['title'].rstrip()
subtitle = request.form['subtitle']
category = request.form['category']