mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-03 11:20:34 +00:00
Fix potential stackoverflow for normalized files
This commit is contained in:
@@ -9,9 +9,9 @@ import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@EqualsAndHashCode
|
||||
public final class FilePath {
|
||||
|
||||
public static boolean isProbableFilePath(OsType osType, String s) {
|
||||
@@ -45,6 +45,20 @@ public final class FilePath {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
FilePath filePath = (FilePath) o;
|
||||
return Objects.equals(value, filePath.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(value);
|
||||
}
|
||||
|
||||
public FilePath fileSystemCompatible(OsType osType) {
|
||||
var split = split();
|
||||
var needsReplacement = split.stream().anyMatch(s -> !s.equals(osType.makeFileSystemCompatible(s)));
|
||||
|
||||
Reference in New Issue
Block a user