Browse Source

Even better error handling

copyvios-ng
Ben Kurtovic 3 years ago
parent
commit
b134ef67ba
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      copyvios/checker.py

+ 3
- 3
copyvios/checker.py View File

@@ -36,9 +36,6 @@ def do_check(query=None):
query.project = query.project.strip().lower() query.project = query.project.strip().lower()
if query.oldid: if query.oldid:
query.oldid = query.oldid.strip().lstrip("0") query.oldid = query.oldid.strip().lstrip("0")
if not re.match(r"^\d+$", query.oldid):
query.error = "bad oldid"
return query


query.submitted = query.project and query.lang and (query.title or query.oldid) query.submitted = query.project and query.lang and (query.title or query.oldid)
if query.submitted: if query.submitted:
@@ -49,6 +46,9 @@ def do_check(query=None):


def _get_results(query, follow=True): def _get_results(query, follow=True):
if query.oldid: if query.oldid:
if not re.match(r"^\d+$", query.oldid):
query.error = "bad oldid"
return
page = query.page = _get_page_by_revid(query.site, query.oldid) page = query.page = _get_page_by_revid(query.site, query.oldid)
if not page: if not page:
return return


Loading…
Cancel
Save