forked from MarseyWorld/MarseyWorld
make repost checking remove the last "/"
parent
ae05471f45
commit
edc511d24a
|
@ -439,7 +439,7 @@ def is_repost(v):
|
||||||
if not FEATURES['REPOST_DETECTION']:
|
if not FEATURES['REPOST_DETECTION']:
|
||||||
return not_a_repost
|
return not_a_repost
|
||||||
|
|
||||||
url = request.values.get('url')
|
url = request.values.get('url').rstrip('/')
|
||||||
if not url or len(url) < MIN_REPOST_CHECK_URL_LENGTH or not url.startswith('http'):
|
if not url or len(url) < MIN_REPOST_CHECK_URL_LENGTH or not url.startswith('http'):
|
||||||
stop(400)
|
stop(400)
|
||||||
|
|
||||||
|
@ -452,7 +452,10 @@ def is_repost(v):
|
||||||
url = escape_for_search(url)
|
url = escape_for_search(url)
|
||||||
|
|
||||||
repost = g.db.query(Post).filter(
|
repost = g.db.query(Post).filter(
|
||||||
|
or_(
|
||||||
Post.url.ilike(url),
|
Post.url.ilike(url),
|
||||||
|
Post.url.ilike(f'{url}/'),
|
||||||
|
),
|
||||||
Post.deleted_utc == 0,
|
Post.deleted_utc == 0,
|
||||||
Post.is_banned == False
|
Post.is_banned == False
|
||||||
).first()
|
).first()
|
||||||
|
|
Loading…
Reference in New Issue