fix: resolve 20 Sentry issues and fix navbar test flakiness

Sentry fixes:
- Only send 5xx errors to Sentry (was sending 4xx rate-limit, media type errors)
- Encode non-ASCII chars in X-Output-Filename header (encodeURIComponent)
- Handle FK constraint failures gracefully in file upload, pipeline save, API keys
- Harden getDirSize against ENOENT race on readdirSync

Test fixes:
- Wrap navbar test renders in act() to flush async useEffect state updates
- Add useEffect cleanup to navbar to prevent state updates on unmounted component
- Fixes timeout when running in full test suite
This commit is contained in:
SnapOtter
2026-05-01 19:01:05 +08:00
parent ff8dcf63c7
commit 66211ed6a7
9 changed files with 128 additions and 87 deletions
+5 -1
View File
@@ -24,14 +24,18 @@ export function Navbar() {
const [stars, setStars] = useState<string>("Star");
useEffect(() => {
let cancelled = false;
fetch("https://api.github.com/repos/snapotter-hq/snapotter")
.then((res) => res.json())
.then((data) => {
if (typeof data.stargazers_count === "number") {
if (!cancelled && typeof data.stargazers_count === "number") {
setStars(formatStarCount(data.stargazers_count));
}
})
.catch(() => {});
return () => {
cancelled = true;
};
}, []);
return (