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:
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user