mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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:
@@ -9,7 +9,7 @@
|
||||
|
||||
import { spawn } from "node:child_process";
|
||||
import crypto from "node:crypto";
|
||||
import { existsSync, readdirSync, readFileSync, statSync, unlinkSync } from "node:fs";
|
||||
import { type Dirent, existsSync, readdirSync, readFileSync, statSync, unlinkSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { shutdownDispatcher } from "@snapotter/ai";
|
||||
import { ANALYTICS_EVENTS, FEATURE_BUNDLES } from "@snapotter/shared";
|
||||
@@ -67,7 +67,12 @@ function getDirSize(dirPath: string): number {
|
||||
if (!existsSync(dirPath)) return 0;
|
||||
|
||||
let total = 0;
|
||||
const entries = readdirSync(dirPath, { withFileTypes: true });
|
||||
let entries: Dirent[];
|
||||
try {
|
||||
entries = readdirSync(dirPath, { withFileTypes: true });
|
||||
} catch {
|
||||
return 0;
|
||||
}
|
||||
for (const entry of entries) {
|
||||
const fullPath = join(dirPath, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
|
||||
Reference in New Issue
Block a user