about summary refs log tree commit diff
path: root/src/routes/plot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/plot.rs')
-rw-r--r--src/routes/plot.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/routes/plot.rs b/src/routes/plot.rs
index 2b4c043..0f698be 100644
--- a/src/routes/plot.rs
+++ b/src/routes/plot.rs
@@ -158,11 +158,16 @@ fn check_gemma_result(posted: &serde_json::Value) -> Result<(), String> {
 /// What `/plot/rqtl` validates in a posted R/qtl result: `data.markers`,
 /// each row `[name, chr, pos, lod, ...]`.
 fn check_rqtl_result(result: &serde_json::Value) -> Result<(), String> {
-    let rows = result["data"]["markers"]
-        .as_array()
-        .ok_or("`data.markers` must be the R/qtl marker array from /compute/rqtl -- post that response back, not a request")?;
+    // `data` is the marker array; a reply from a build before that change kept
+    // it under `data.markers`, and a caller may still be holding one.
+    let rows = if result["data"].is_array() {
+        result["data"].as_array()
+    } else {
+        result["data"]["markers"].as_array()
+    }
+    .ok_or("`data` must be the R/qtl marker array from /compute/rqtl -- post that response back, not a request")?;
     if rows.is_empty() {
-        return Err("`data.markers` is empty: nothing to plot".to_string());
+        return Err("`data` is empty: nothing to plot".to_string());
     }
     let first = rows[0]
         .as_array()
@@ -346,7 +351,7 @@ pub async fn plot_gemma(
 }
 
 /// The SVG, with the plotter's summary alongside it.
-fn svg_response(rendered: plot::Plot) -> Response {
+pub(crate) fn svg_response(rendered: plot::Plot) -> Response {
     let mut response = rendered.svg.into_response();
     let headers = response.headers_mut();
     headers.insert(