fix: Profilbild-Upload auf JSON/Base64 umgestellt statt multipart
POST /profile/avatar schlug live mit net::ERR_FAILED fehl (Verbindung abgebrochen, keine Antwort) - selbst bei einer winzigen Testdatei. CORS-Preflight lief sauber durch, nur der eigentliche multipart-POST nicht; passt zum bereits dokumentierten Cloudflare-Verhalten bei multipart-Uploads (siehe .gitea/workflows/*-image.yml). Umgangen durch Umstellung auf denselben JSON-Content-Type, der fuer alle anderen Endpunkte nachweislich zuverlaessig funktioniert: Bild wird clientseitig als data:-URL kodiert und im JSON-Body gesendet. Globales JSON-Body-Limit auf 5mb angehoben (deckt 2MB-Bild plus Base64-Overhead).
This commit is contained in:
1 parent
abe1f6e8cf
commit
135738fdfc
7 files changed
+81
-49
No files matched your search
@@ -10,6 +10,11 @@ export function configureApp(app: NestExpressApplication): void {
|
||||
// real client IP from X-Forwarded-For — required for per-client throttling
|
||||
// to work correctly rather than rate-limiting all traffic together.
|
||||
app.set('trust proxy', 1);
|
||||
// Default 100kb JSON body limit is too small for the avatar upload, which
|
||||
// sends the image as a base64 data: URL in the JSON body (not multipart -
|
||||
// see profile/dto/upload-avatar.dto.ts for why) - 5mb comfortably covers
|
||||
// the 2MB decoded size cap plus base64 overhead.
|
||||
app.useBodyParser('json', { limit: '5mb' });
|
||||
app.use(helmet());
|
||||
app.use(cookieParser());
|
||||
app.use(requestLoggerMiddleware);
|
||||
|
||||
Reference in new issue
Block a user