From 62cd5c776cb0f6cbcfc4e0ae84342bc6974d8c7d Mon Sep 17 00:00:00 2001 From: Andrey Prygunkov Date: Sun, 3 Jul 2016 12:47:53 +0200 Subject: [PATCH] #227: fixed check for reserved characters in file names (Windows) --- daemon/util/FileSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/util/FileSystem.cpp b/daemon/util/FileSystem.cpp index f9b56bad..e4b10477 100644 --- a/daemon/util/FileSystem.cpp +++ b/daemon/util/FileSystem.cpp @@ -915,7 +915,7 @@ bool FileSystem::NeedLongPath(const char* path) } Tokenizer tok(path, "\\/"); - while (const char* part = tok.Next()) + for (int partNo = 0; const char* part = tok.Next(); partNo++) { // check if the file part starts with a reserved device name for (const char** ptr = RESERVED_DEVICE_NAMES; const char* reserved = *ptr; ptr++) @@ -930,7 +930,7 @@ bool FileSystem::NeedLongPath(const char* path) // check if the file part contains reserved characters for (const char* p = part; *p; p++) { - if (ReservedChar(*p)) + if (ReservedChar(*p) && !(partNo == 0 && p == part + 1 && *p == ':')) { return true; }