mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
slugify community urls #78
This commit is contained in:
parent
e6431584ab
commit
635449db0f
2 changed files with 3 additions and 0 deletions
|
@ -5,6 +5,7 @@ from random import randint
|
||||||
from flask import redirect, url_for, flash, request, make_response, session, Markup, current_app, abort, g, json
|
from flask import redirect, url_for, flash, request, make_response, session, Markup, current_app, abort, g, json
|
||||||
from flask_login import current_user, login_required
|
from flask_login import current_user, login_required
|
||||||
from flask_babel import _
|
from flask_babel import _
|
||||||
|
from slugify import slugify
|
||||||
from sqlalchemy import or_, desc, text
|
from sqlalchemy import or_, desc, text
|
||||||
|
|
||||||
from app import db, constants, cache
|
from app import db, constants, cache
|
||||||
|
@ -47,6 +48,7 @@ def add_local():
|
||||||
# todo: more intense data validation
|
# todo: more intense data validation
|
||||||
if form.url.data.strip().lower().startswith('/c/'):
|
if form.url.data.strip().lower().startswith('/c/'):
|
||||||
form.url.data = form.url.data[3:]
|
form.url.data = form.url.data[3:]
|
||||||
|
form.url.data = slugify(form.url.data)
|
||||||
private_key, public_key = RsaKeys.generate_keypair()
|
private_key, public_key = RsaKeys.generate_keypair()
|
||||||
community = Community(title=form.community_name.data, name=form.url.data, description=form.description.data,
|
community = Community(title=form.community_name.data, name=form.url.data, description=form.description.data,
|
||||||
rules=form.rules.data, nsfw=form.nsfw.data, private_key=private_key,
|
rules=form.rules.data, nsfw=form.nsfw.data, private_key=private_key,
|
||||||
|
|
|
@ -31,3 +31,4 @@ redis==5.0.1
|
||||||
Werkzeug==2.3.3
|
Werkzeug==2.3.3
|
||||||
pytesseract==0.3.10
|
pytesseract==0.3.10
|
||||||
sentry-sdk==1.40.6
|
sentry-sdk==1.40.6
|
||||||
|
python-slugify==8.0.4
|
||||||
|
|
Loading…
Reference in a new issue