Added fix for XSS bug in search
This commit is contained in:
Родитель
700b45a7e2
Коммит
2e415472c3
|
@ -18,6 +18,8 @@ from flask import send_file
|
|||
from predict import Predict
|
||||
from sample_images import Sample_images
|
||||
|
||||
from flask import escape
|
||||
|
||||
search = Search()
|
||||
predict = Predict()
|
||||
sample_images = Sample_images()
|
||||
|
@ -216,7 +218,7 @@ def get_images():
|
|||
@app.route('/get_search_results', methods=['GET'])
|
||||
def get_search_results():
|
||||
try:
|
||||
search_string = request.args.get("searchString")
|
||||
search_string = escape(request.args.get("searchString"))
|
||||
search.do_search(search_string)
|
||||
result = search.result.fillna(' ')
|
||||
|
||||
|
@ -230,7 +232,7 @@ def get_search_results():
|
|||
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
return str(e)
|
||||
return "Error occurred while processing the request. The search term could be invalid"
|
||||
|
||||
@app.route('/get_more_search_images', methods=['GET'])
|
||||
def get_more_search_images():
|
||||
|
@ -298,4 +300,4 @@ def check_image_url():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(threaded=True, host="0.0.0.0")
|
||||
app.run(threaded=True, host="0.0.0.0")
|
||||
|
|
Загрузка…
Ссылка в новой задаче