From 6434919b9f2ac7cde18b724ef46f6a13207b3d85 Mon Sep 17 00:00:00 2001 From: Roland Stigge Date: Fri, 5 Jan 2018 22:23:59 +0100 Subject: Fix upload bug --- src/webbox.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/webbox.cpp') diff --git a/src/webbox.cpp b/src/webbox.cpp index 6378d5e..b5d35c2 100644 --- a/src/webbox.cpp +++ b/src/webbox.cpp @@ -255,16 +255,17 @@ int main(int argc, char* argv[]) { } else { QString contentType(FCGX_GetParam("CONTENT_TYPE", request.envp)); - if (!contentType.contains("boundary=--")) { + QString separator("boundary="); + if (!contentType.contains(separator)) { FCGX_PutS(QString("No boundary defined").toUtf8().data(), request.out); } else { - QByteArray boundary = contentType.split("boundary=--")[1].toUtf8(); + QByteArray boundary = QByteArray("--") + contentType.split(separator)[1].toUtf8(); int boundaryCount = content.count(boundary); if (boundaryCount != 2) { FCGX_PutS(QString("Bad boundary number found: %1").arg(boundaryCount).toUtf8().data(), request.out); } else { int start = content.indexOf(boundary) + boundary.size(); - int end = content.indexOf(boundary, start); + int end = content.indexOf(QByteArray("\r\n") + boundary, start); content = content.mid(start, end - start); -- cgit v1.2.3