1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-26 15:13:21 +00:00

Requested changes to logic behind ... in file path.

This commit is contained in:
Wojbie 2017-09-10 17:51:29 +02:00
parent 0d5397db34
commit 6aa4a385a3

View File

@ -740,6 +740,7 @@ private static String sanitizePath( String path )
return sanitizePath( path, false );
}
private static final Pattern threeDotsPattern = Pattern.compile( "^\\.{3,}$" );
private static String sanitizePath( String path, boolean allowWildcards )
{
// Allow windowsy slashes
@ -765,7 +766,7 @@ private static String sanitizePath( String path, boolean allowWildcards )
Stack<String> outputParts = new Stack<String>();
for( String part : parts )
{
if( part.length() == 0 || part.equals( "." ) || part.matches( "^\\.{3,}$" ) )
if( part.length() == 0 || part.equals( "." ) || threeDotsPattern.matcher( part ).matches() )
{
// . is redundant
// ... and more are treated as .