1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-09-27 14:48:20 +00:00

Modify logic behind ... and more in file path.

Changes all equal or longer then 3 multidots setups to be treated as .
This removes other potentialy dangerus situations and brings it closer to windows in how it treats said dots.
This commit is contained in:
Wojbie 2017-07-30 14:11:25 +02:00
parent 579f7443a8
commit 0d5397db34

View File

@ -765,14 +765,15 @@ public class FileSystem
Stack<String> outputParts = new Stack<String>();
for( String part : parts )
{
if( part.length() == 0 || part.equals( "." ) )
if( part.length() == 0 || part.equals( "." ) || part.matches( "^\\.{3,}$" ) )
{
// . is redundant
// ... and more are treated as .
continue;
}
else if( part.equals( ".." ) || part.equals( "..." ) )
else if( part.equals( ".." ) )
{
// .. or ... can cancel out the last folder entered
// .. can cancel out the last folder entered
if( !outputParts.empty() )
{
String top = outputParts.peek();