From fd041e5996fa0706f293705fa21bb0dc3511eedf Mon Sep 17 00:00:00 2001 From: Luc Vachon Date: Thu, 12 Nov 2026 15:49:26 -0500 Subject: [PATCH 1/2] Added logic to force schedule_direction to be a map even when the parameters passed in the URL are not (crawlers) --- lib/dotcom_web/controllers/schedule/line.ex | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/dotcom_web/controllers/schedule/line.ex b/lib/dotcom_web/controllers/schedule/line.ex index d6aeb1cda4..2ac4c149e2 100644 --- a/lib/dotcom_web/controllers/schedule/line.ex +++ b/lib/dotcom_web/controllers/schedule/line.ex @@ -89,7 +89,15 @@ defmodule DotcomWeb.Schedule.Line do @spec update_conn(Conn.t(), Route.t(), direction_id) :: Conn.t() defp update_conn(conn, route, direction_id) do schedule_direction = Map.get(conn.query_params, "schedule_direction", %{}) - variant = schedule_direction["variant"] + + schedule_direction = + if !is_map(schedule_direction) do + %{} + else + schedule_direction + end + + variant = schedule_direction |> Map.get("variant", "") expanded = Map.get(conn.query_params, "expanded") reverse_direction_id = reverse_direction(direction_id) route_stops = LineHelpers.get_route_stops(route.id, direction_id) From 0a0bb80295b1de6a54f5fb31e9a94a526faabbb4 Mon Sep 17 00:00:00 2001 From: Luc Vachon Date: Thu, 12 Nov 2026 16:11:01 -0500 Subject: [PATCH 2/2] lint --- lib/dotcom_web/controllers/schedule/line.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/dotcom_web/controllers/schedule/line.ex b/lib/dotcom_web/controllers/schedule/line.ex index 2ac4c149e2..969f26d36f 100644 --- a/lib/dotcom_web/controllers/schedule/line.ex +++ b/lib/dotcom_web/controllers/schedule/line.ex @@ -91,10 +91,10 @@ defmodule DotcomWeb.Schedule.Line do schedule_direction = Map.get(conn.query_params, "schedule_direction", %{}) schedule_direction = - if !is_map(schedule_direction) do - %{} - else + if is_map(schedule_direction) do schedule_direction + else + %{} end variant = schedule_direction |> Map.get("variant", "")