about summary refs log tree commit diff
path: root/src/routes/plot.rs
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-11-27 11:22:38 +0000
committerPjotr Prins <pjotr.public01@thebird.nl>2026-11-27 11:22:38 +0000
commitcd9f46633bcc55ab2a72cda1a0f1a667e79c2e57 (patch)
treee56b04e85f9d69b28695ed57345c1dff28d8d14c /src/routes/plot.rs
parentf76043bf82b6c86b5e844b27b53e957d770aeb33 (diff)
parent4f609454ba5b8db543863d6f20b042ca15cfe99f (diff)
downloadgenenetwork4-cd9f46633bcc55ab2a72cda1a0f1a667e79c2e57.tar.gz
Merge branch 'main' into search/extract-engine-merge
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(