diff mbox series

[layerindex-web,1/3] layerindex/views: BranchCompareView: fix to_branch check

Message ID 20261017165703.70617-1-tim.orling@konsulko.com
State New
Headers show
Series [layerindex-web,1/3] layerindex/views: BranchCompareView: fix to_branch check | expand

Commit Message

Tim Orling Oct. 17, 2026, 4:57 p.m. UTC
The to_branch lookup was guarded by from_branch_id instead of
to_branch_id, so a request with only from_branch set tried to fetch a
Branch with id None and returned a 404 instead of the empty form.

AI-Generated: Claude Opus 5.5
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 layerindex/views.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/layerindex/views.py b/layerindex/views.py
index 4f8e64e..73a4f6a 100644
--- a/layerindex/views.py
+++ b/layerindex/views.py
@@ -1927,7 +1927,7 @@  class BranchCompareView(FormView):
             from_branch = get_object_or_404(Branch, id=from_branch_id)
         context['from_branch'] = from_branch
         to_branch = None
-        if from_branch_id is not None:
+        if to_branch_id is not None:
             to_branch = get_object_or_404(Branch, id=to_branch_id)
         context['to_branch'] = to_branch
         if from_branch and to_branch: