Commit dfb7d928 authored by Katerina Blinova's avatar Katerina Blinova

Review revision for windows path separator detection in mg_upload

parent 4bb9faaf
...@@ -4226,11 +4226,10 @@ int mg_upload(struct mg_connection *conn, const char *destination_dir) { ...@@ -4226,11 +4226,10 @@ int mg_upload(struct mg_connection *conn, const char *destination_dir) {
// there is no other thread can save into the same file simultaneously. // there is no other thread can save into the same file simultaneously.
fp = NULL; fp = NULL;
// Construct destination file name. Do not allow paths to have slashes. // 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; s = fname;
} }
}
// Open file in binary mode. TODO: set an exclusive lock. // Open file in binary mode. TODO: set an exclusive lock.
snprintf(path, sizeof(path), "%s/%s", destination_dir, s); snprintf(path, sizeof(path), "%s/%s", destination_dir, s);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment