diff --git a/mongoose.c b/mongoose.c index 762b9091a7b7fdaa4225b2ca6c4b7c634f6c387f..348db9a969bf4645cc2b79c009b7508e906007a6 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4226,10 +4226,9 @@ int mg_upload(struct mg_connection *conn, const char *destination_dir) { // there is no other thread can save into the same file simultaneously. fp = NULL; // Construct destination file name. Do not allow paths to have slashes. - if ((s = strrchr(fname, '/')) == NULL) { - if ((s = strrchr(fname, '\\')) == NULL) { + if ((s = strrchr(fname, '/')) == NULL && + (s = strrchr(fname, '\\')) == NULL) { s = fname; - } } // Open file in binary mode. TODO: set an exclusive lock.