fix: Limit link chars to letters and numbers
All checks were successful
Build Docker / Build Main Image (push) Successful in 20s
All checks were successful
Build Docker / Build Main Image (push) Successful in 20s
This commit is contained in:
parent
e0d2e89c55
commit
a1122419e9
2
db.py
2
db.py
@ -52,6 +52,7 @@ def get_link_count():
|
|||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
cursor.execute("SELECT COUNT(*) FROM links")
|
cursor.execute("SELECT COUNT(*) FROM links")
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
|
cursor.fetchall()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ def get_account_count():
|
|||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
cursor.execute("SELECT * FROM links")
|
cursor.execute("SELECT * FROM links")
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
|
cursor.fetchall()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
connection.close()
|
connection.close()
|
||||||
last_check_account = time.time()
|
last_check_account = time.time()
|
||||||
|
4
main.py
4
main.py
@ -114,6 +114,10 @@ def add_link():
|
|||||||
if len(link) < 5:
|
if len(link) < 5:
|
||||||
return error('Link too short')
|
return error('Link too short')
|
||||||
|
|
||||||
|
regexmatch = re.match(r"^[a-zA-Z0-9]+$", link)
|
||||||
|
if not regexmatch:
|
||||||
|
return error('Invalid link')
|
||||||
|
|
||||||
# Verify link is not taken
|
# Verify link is not taken
|
||||||
if db.get_link(link) != False:
|
if db.get_link(link) != False:
|
||||||
return error('Link already taken')
|
return error('Link already taken')
|
||||||
|
Loading…
Reference in New Issue
Block a user