Fix bug in wxFileName::Normalize() with leading ".."
Don't discard initial ".." when there is more than one such component in the beginning of the path. Closes #18800.
This commit is contained in:
committed by
Vadim Zeitlin
parent
ff87733cd8
commit
a571a13d44
@@ -1518,13 +1518,16 @@ bool wxFileName::Normalize(int flags,
|
||||
continue;
|
||||
|
||||
}
|
||||
else // Normal case, go one step up.
|
||||
else // Normal case, go one step up unless it's .. as well.
|
||||
{
|
||||
if (m_dirs.back() != wxT("..") )
|
||||
{
|
||||
m_dirs.pop_back();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_dirs.Add(dir);
|
||||
}
|
||||
|
@@ -355,6 +355,7 @@ void FileNameTestCase::TestNormalize()
|
||||
{ "b/../bar", wxPATH_NORM_DOTS, "bar", wxPATH_UNIX },
|
||||
{ "c/../../quux", wxPATH_NORM_DOTS, "../quux", wxPATH_UNIX },
|
||||
{ "/c/../../quux", wxPATH_NORM_DOTS, "/quux", wxPATH_UNIX },
|
||||
{ "../../quux", wxPATH_NORM_DOTS, "../../quux", wxPATH_UNIX },
|
||||
|
||||
// test wxPATH_NORM_TILDE: notice that ~ is only interpreted specially
|
||||
// when it is the first character in the file name
|
||||
|
Reference in New Issue
Block a user