mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-07-18 01:42:52 +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:
parent
579f7443a8
commit
0d5397db34
@ -765,14 +765,15 @@ public class FileSystem
|
|||||||
Stack<String> outputParts = new Stack<String>();
|
Stack<String> outputParts = new Stack<String>();
|
||||||
for( String part : parts )
|
for( String part : parts )
|
||||||
{
|
{
|
||||||
if( part.length() == 0 || part.equals( "." ) )
|
if( part.length() == 0 || part.equals( "." ) || part.matches( "^\\.{3,}$" ) )
|
||||||
{
|
{
|
||||||
// . is redundant
|
// . is redundant
|
||||||
|
// ... and more are treated as .
|
||||||
continue;
|
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() )
|
if( !outputParts.empty() )
|
||||||
{
|
{
|
||||||
String top = outputParts.peek();
|
String top = outputParts.peek();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user