Added filter to check if a website can be scanned from its parent directory

This commit is contained in:
Simon
2018-07-10 10:14:23 -04:00
parent f226b82f5a
commit d138db8f06
4 changed files with 46 additions and 9 deletions

9
app.py
View File

@@ -322,8 +322,12 @@ def submit():
def try_enqueue(url):
url = os.path.join(url, "")
website = db.get_website_by_url(url)
url = od_util.get_top_directory(url)
if not od_util.is_valid_url(url):
return "<strong>Error:</strong> Invalid url. Make sure to include the appropriate scheme.", "warning"
website = db.get_website_by_url(url)
if website:
return "Website already exists", "danger"
@@ -331,9 +335,6 @@ def try_enqueue(url):
if website:
return "A parent directory of this url has already been posted", "danger"
if not od_util.is_valid_url(url):
return "<strong>Error:</strong> Invalid url. Make sure to include the appropriate scheme.", "danger"
if db.is_blacklisted(url):
return "<strong>Error:</strong> " \
"Sorry, this website has been blacklisted. If you think " \