From 35289a04f2a4963172755ccba1f0b708550f8fc4 Mon Sep 17 00:00:00 2001 From: Stephen Parkinson Date: Sat, 28 Feb 2026 23:14:54 -0800 Subject: [PATCH] fix password auto-fill --- Frontend/src/pages/PasteView.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Frontend/src/pages/PasteView.tsx b/Frontend/src/pages/PasteView.tsx index 1e39fef..608ae9c 100644 --- a/Frontend/src/pages/PasteView.tsx +++ b/Frontend/src/pages/PasteView.tsx @@ -36,15 +36,17 @@ export default function PasteView() { >("loading"); const [copied, setCopied] = useState(false); const [linkCopied, setLinkCopied] = useState(false); - const [passwordInput, setPasswordInput] = useState( - (location.state as { password?: string })?.password ?? "", - ); + const [passwordInput, setPasswordInput] = useState(""); const [passwordError, setPasswordError] = useState(null); const [unlocking, setUnlocking] = useState(false); + const initialPassword = (location.state as { password?: string })?.password; + useEffect(() => { if (!id) return; - fetch(`/api/paste/${id}`) + const headers: HeadersInit = {}; + if (initialPassword) headers["X-Paste-Password"] = initialPassword; + fetch(`/api/paste/${id}`, { headers }) .then((res) => { if (res.status === 404) { setStatus("notfound");