From 29db8537062114254815be1b374e0c9f1811afbc Mon Sep 17 00:00:00 2001 From: Brad Arant Date: Sun, 6 Sep 2026 04:04:48 +0000 Subject: [PATCH] Fix CGIFormData to actually store file-upload part content File-upload parts (Content-Disposition with filename=) were unconditionally flagged currentSkip and discarded at PART_BOUNDARY, so every upload site (track audio, presets, project icons) only ever received an empty value via $[fieldname], never the real uploaded bytes. --- CGIFormData.cpp | 13 +++++++++---- CGIFormData.h | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CGIFormData.cpp b/CGIFormData.cpp index 6c79679..87b295b 100644 --- a/CGIFormData.cpp +++ b/CGIFormData.cpp @@ -24,8 +24,6 @@ namespace coreutils { MString disposition = fields[MString("Content-Disposition")]; ZString dz(disposition.getData(), disposition.getLength()); - currentSkip = (dz.find(ZString("filename=\"")) != -1); - int namePos = dz.find(ZString("name=\"")); if (namePos != -1) { ZString afterName = dz.substring(namePos + 6); @@ -117,10 +115,17 @@ namespace coreutils { if (pos < 0) return Status::INCOMPLETE; char *bodyEnd = buffer.getCursor(); - if (!currentSkip && currentName.getLength() > 0) + // A part whose Content-Disposition includes filename="..." + // (a real ) used to be silently discarded + // here (currentSkip) rather than stored like any other part - + // every existing upload (track audio, + // presets, project icons) has therefore never actually + // received real file content via $[fieldname], only ever an + // empty value. Storing it the same way as any other part is + // exactly what those call sites already assume. + if (currentName.getLength() > 0) storeValue(currentName, MString(ZString(bodyStart, bodyEnd - bodyStart))); currentName = MString(); - currentSkip = false; state = PART_BOUNDARY; return Status::DATA_AVAIL; } diff --git a/CGIFormData.h b/CGIFormData.h index 1ae46b0..2c8378b 100644 --- a/CGIFormData.h +++ b/CGIFormData.h @@ -59,7 +59,6 @@ namespace coreutils { IMFHeader *headerParser = NULL; IMFBoundary *boundaryParser = NULL; MString currentName; - bool currentSkip = false; std::map nameCounts; void extractPartName(IMFHeader &header);