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 --- TODO | 1 - src/webbox.cpp | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index ba7f43c..e062301 100644 --- a/TODO +++ b/TODO @@ -6,7 +6,6 @@ debian/ implement TBD features handle spaces/umlauts download zip -Upload bug Refresh Prio 2 (for future versions) 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