From 793e2465a75900f63228729c4b6bac4a6778d0bd Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 5 Jul 2023 19:41:49 +0000 Subject: Fix bug where mapping is sometimes wrongly submitted as a GET request I think this bug was caused by changing the /run_mapping endpoint to accept both GET and POST requests, and it only seemed to occur for some users (only Rob that I'm aware of). I'm still not sure why it was happening, but I addressed it by returning /run_mapping to being only POST requests, and instead allowing the mapping hashes to be linked to with the pattern /run_mapping/ (instead of the GET request /run_mapping?hash=). This appears to have prevented the problem from happening. --- wqflask/wqflask/templates/mapping_results.html | 2 +- wqflask/wqflask/views.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index b1e1b5c8..03ea3872 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -676,7 +676,7 @@ }) hash = $('input[name=inputs_hash]').val(); - mappingLink = window.location.origin + "/run_mapping?hash=" + hash; + mappingLink = window.location.origin + "/run_mapping/"+ hash; $('input[name=mappingLink]').width(mappingLink.length*0.95 + "ch") $('input[name=mappingLink]').val(mappingLink); $('.share-results').click(function() { diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index ca2c34cd..320a98ef 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -702,10 +702,10 @@ def loading_page(): return rendered_template -@app.route("/run_mapping", methods=('POST','GET')) -def mapping_results_page(): - if request.method == "GET" and (hash_of_inputs := request.args.get("hash")): - hash_of_inputs = request.args.get("hash") +@app.route("/run_mapping", methods=('POST',)) +@app.route("/run_mapping/") +def mapping_results_page(hash_of_inputs=None): + if hash_of_inputs: initial_start_vars = json.loads(Redis.get(hash_of_inputs)) initial_start_vars['hash_of_inputs'] = hash_of_inputs else: -- cgit v1.2.3