Fix mg_http_upload()

This commit is contained in:
Sergey Lyubka committed 2022-06-13 14:48:52 +01:00
1 parent 6d46ecaa6c
commit 30d6a44b0d
3 files changed
+54 -2

No files matched your search

+3 -1
View File
@@ -865,7 +865,9 @@ int mg_http_upload(struct mg_connection *c, struct mg_http_message *hm,
if (name[0] == '\0') {
mg_http_reply(c, 400, "", "%s", "name required");
res = -1;
} else if (hm->body.len > 0) {
} else if (hm->body.len == 0) {
mg_http_reply(c, 200, "", "%d", res); // Nothing to write
} else {
struct mg_fd *fd;
long oft = strtol(offset, NULL, 0);
mg_snprintf(path, sizeof(path), "%s%c%s", dir, MG_DIRSEP, name);