We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fcef19d commit af44998Copy full SHA for af44998
page_analyzer/app.py
@@ -22,8 +22,11 @@ def get_db_connection():
22
@app.route('/', methods=['GET', 'POST'])
23
def index():
24
if request.method == 'POST':
25
- url = request.form['url']
26
- return redirect(url_for('urls', url=url))
+ url_input = request.form.get('url')
+ if not validators.url(url_input) or len(url_input) > 255:
27
+ flash('Некорректный URL', 'error')
28
+ return render_template('index.html'), 422
29
+ return redirect(url_for('urls', url=url_input))
30
return render_template('index.html')
31
32
@app.route('/urls', methods=['GET', 'POST'])
0 commit comments