From c635d4396cd33020148154fa14bd4de375310b26 Mon Sep 17 00:00:00 2001 From: Matteo Luppi <100372313+lups2000@users.noreply.github.com> Date: Tue, 19 Aug 2025 20:22:53 +0200 Subject: [PATCH] Console: Prevent showing the quit message when no flows are available in specific configurations (#7833) * prevent showing the quit message when no filtered flows are available * update changelog --- CHANGELOG.md | 2 ++ mitmproxy/tools/console/flowview.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2aaeb4cd..1dbd60ea9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ ([#7749](https://github.com/mitmproxy/mitmproxy/pull/7749), @mhils) - Display local timezone in the Timing tab of mitmweb. ([#7804](https://github.com/mitmproxy/mitmproxy/pull/7804), @lups2000) +- Prevent showing the quit message in the console when no flows are available under specific configurations. + ([#7833](https://github.com/mitmproxy/mitmproxy/pull/7833), @lups2000) ## 25 May 2025: mitmproxy 12.1.1 diff --git a/mitmproxy/tools/console/flowview.py b/mitmproxy/tools/console/flowview.py index cb9c12ac9..ec942ece3 100644 --- a/mitmproxy/tools/console/flowview.py +++ b/mitmproxy/tools/console/flowview.py @@ -104,7 +104,12 @@ class FlowDetails(tabs.Tabs): ] self.show() else: - self.master.window.pop() + # Get the top window from the focus stack (the currently active view). + # If it's NOT the "flowlist", it's safe to pop back to the previous view. + if self.master.window.focus_stack().stack[-1] != "flowlist": + self.master.window.pop() + # If it is the "flowlist", we’re already at the main view with no flows to show. + # Popping now would close the last window and prompt app exit, so we remain on the empty flow list screen instead. def tab_http_request(self): flow = self.flow