From 9a224f2b5c18f903bcc776eb51955505d0ce148f Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Wed, 22 Jun 2011 01:22:52 +0200 Subject: [PATCH] Fix to problems with regex characters in group names. Stolen from https://bitbucket.org/squire_linden/viewer-dev-chop-662/changeset/6f971899f351 --- indra/llvfs/lldiriterator.cpp | 11 ++++++++--- indra/newview/lllogchat.cpp | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/indra/llvfs/lldiriterator.cpp b/indra/llvfs/lldiriterator.cpp index 9434efd40..cef016e0c 100644 --- a/indra/llvfs/lldiriterator.cpp +++ b/indra/llvfs/lldiriterator.cpp @@ -142,9 +142,6 @@ std::string glob_to_regex(const std::string& glob) switch (c) { - case '.': - regex+="\\."; - break; case '*': if (glob.begin() == i) { @@ -177,6 +174,14 @@ std::string glob_to_regex(const std::string& glob) case '!': regex+= square_brace_open ? '^' : c; break; + case '.': // This collection have different regex meaning + case '^': // And so need escaping + case '(': + case ')': + case '+': + case '|': + case '$': + regex+='\\'; default: regex+=c; break; diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index cf52896e8..574d70f4b 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -66,7 +66,7 @@ std::string LLLogChat::makeLogFileName(std::string filename) std::string LLLogChat::cleanFileName(std::string filename) { - std::string invalidChars = "\"\'\\/?*:<>|"; + std::string invalidChars = "\"\'\\/?*:<>|[]{}~"; // Cannot match glob or illegal filename chars S32 position = filename.find_first_of(invalidChars); while (position != filename.npos) {