From f8e95564b55d6cb2b41757be9296f9803af30cb7 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 13 Mar 2023 20:51:30 +0200 Subject: [PATCH] make h/hole be valid syntax for moving post --- files/helpers/get.py | 2 +- files/routes/reporting.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/files/helpers/get.py b/files/helpers/get.py index c75025eb2..b7eddef4c 100644 --- a/files/helpers/get.py +++ b/files/helpers/get.py @@ -347,7 +347,7 @@ def get_sub_by_name(sub:str, v:Optional[User]=None, graceful=False) -> Optional[ if not sub: if graceful: return None else: abort(404) - sub = sub.replace('/h/', '').strip().lower() + sub = sub.replace('/h/', '').replace('h/', '').strip().lower() if not sub: if graceful: return None else: abort(404) diff --git a/files/routes/reporting.py b/files/routes/reporting.py index da75e6f41..70d063792 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -145,7 +145,9 @@ def remove_report_comment(v, cid, uid): return {"message": "Report removed successfully!"} def move_post(post:Submission, v:User, reason:str) -> Union[bool, str]: - if not reason.startswith('/h/'): return False + if not reason.startswith('/h/') and not reason.startswith('h/'): + return False + sub_from = post.sub sub_to = get_sub_by_name(reason, graceful=True) sub_to = sub_to.name if sub_to else None