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);