diff options
Diffstat (limited to 'src/messaging/maildirStore.cpp')
-rw-r--r-- | src/messaging/maildirStore.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/messaging/maildirStore.cpp b/src/messaging/maildirStore.cpp index 2f737622..3434321f 100644 --- a/src/messaging/maildirStore.cpp +++ b/src/messaging/maildirStore.cpp @@ -77,9 +77,23 @@ folder* maildirStore::getFolder(const folder::path& path) const bool maildirStore::isValidFolderName(const folder::path::component& name) { - return (platformDependant::getHandler()-> - getFileSystemFactory()->isValidPathComponent(name) && - name.getBuffer().find_first_of(".") == string::npos); + if (!platformDependant::getHandler()->getFileSystemFactory()->isValidPathComponent(name)) + return false; + + const string& buf = name.getBuffer(); + + // Name cannot start/end with spaces + if (stringUtils::trim(buf) != name.getBuffer()) + return false; + + // Name cannot start with '.' + const int length = buf.length(); + int pos = 0; + + while ((pos < length) && (buf[pos] == '.')) + ++pos; + + return (pos == 0); } |