From 995205ed1680f6cf9dfb7c300f566796f70eda35 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 May 2026 17:09:27 +1000 Subject: [PATCH] fix(portfolio-master): visible skip warning + clearer caption When a user selects a folder in the upload picker (browser behaviour that bypasses type filter), all files come through and only valid extensions get processed. Make the skipped count visible and update the caption to set expectations. --- view_portfolio_master.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/view_portfolio_master.py b/view_portfolio_master.py index f677bfd..f71b19e 100644 --- a/view_portfolio_master.py +++ b/view_portfolio_master.py @@ -544,7 +544,8 @@ def render(): # ── Upload ─────────────────────────────────────────────────────────────── with st.expander("📂 Upload Backtest Files", expanded=not bool(st.session_state.pm_files)): - st.caption("Accepts `.htm` · `.html` · `.csv`") + st.caption("Accepts `.htm` · `.html` · `.csv` — selecting a folder will only " + "import the supported files inside it (others are skipped).") uploaded = st.file_uploader( "Select files", type=["htm", "html", "csv"], @@ -552,9 +553,15 @@ def render(): key=f"pm_uploader_{st.session_state.pm_uploader_key}", ) if uploaded: - # Streamlit already filters by type, defensive check anyway - uploaded = [f for f in uploaded + # Some browsers ignore the type filter when a folder is selected — + # filter again here and report what was skipped. + valid = [f for f in uploaded if f.name.lower().endswith((".htm",".html",".csv"))] + rejected = len(uploaded) - len(valid) + if rejected: + st.warning(f"⚠️ Skipped {rejected} non-supported file(s). " + f"Importing {len(valid)} valid file(s).") + uploaded = valid for f in uploaded: stem = os.path.splitext(f.name)[0] if stem not in st.session_state.pm_files: