aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2023-07-05 19:41:49 +0000
committerzsloan2023-07-05 19:41:49 +0000
commit793e2465a75900f63228729c4b6bac4a6778d0bd (patch)
tree931928978dc099af4a656e1a7818c131d6faea2a /wqflask
parente9640394e0e7c28d54cdd8c7a805c7dffa3f0be0 (diff)
downloadgenenetwork2-793e2465a75900f63228729c4b6bac4a6778d0bd.tar.gz
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/<hash> (instead of the GET request /run_mapping?hash=<hash>). This appears to have prevented the problem from happening.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/templates/mapping_results.html2
-rw-r--r--wqflask/wqflask/views.py8
2 files changed, 5 insertions, 5 deletions
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/<path:hash_of_inputs>")
+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: