mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-15 04:41:37 +08:00
Workaround for snapshot files with not-to-spec slashes.
This commit is contained in:
parent
8e53aa0891
commit
beca3a707d
@ -97,10 +97,15 @@ protected InputStream getInputStream(String name, String worldName) throws IOExc
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements(); ) {
|
||||
ZipEntry testEntry = e.nextElement();
|
||||
// Check for world
|
||||
if (worldPattern.matcher(testEntry.getName()).matches()) {
|
||||
String entryName = testEntry.getName();
|
||||
if (worldPattern.matcher(entryName).matches()) {
|
||||
// Check for file
|
||||
if (pattern.matcher(testEntry.getName()).matches()) {
|
||||
folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf('/'));
|
||||
if (pattern.matcher(entryName).matches()) {
|
||||
int endIndex = entryName.lastIndexOf('/');
|
||||
if (endIndex < 0) {
|
||||
endIndex = entryName.lastIndexOf('\\');
|
||||
}
|
||||
folder = entryName.substring(0, endIndex);
|
||||
if (folder.endsWith("poi")) {
|
||||
continue;
|
||||
}
|
||||
|
@ -81,12 +81,18 @@ protected InputStream getInputStream(String name, String worldName) throws IOExc
|
||||
}
|
||||
} else {
|
||||
Pattern pattern = Pattern.compile(".*\\.mc[ra]$");
|
||||
Pattern worldPattern = Pattern.compile(worldName + "[\\\\/].*");
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements(); ) {
|
||||
ZipEntry testEntry = e.nextElement();
|
||||
// Check for world
|
||||
if (testEntry.getName().startsWith(worldName + "/")) {
|
||||
if (pattern.matcher(testEntry.getName()).matches()) { // does entry end in .mca
|
||||
folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf('/'));
|
||||
String entryName = testEntry.getName();
|
||||
if (worldPattern.matcher(entryName).matches()) {
|
||||
if (pattern.matcher(entryName).matches()) { // does entry end in .mca
|
||||
int endIndex = entryName.lastIndexOf('/');
|
||||
if (endIndex < 0) {
|
||||
endIndex = entryName.lastIndexOf('\\');
|
||||
}
|
||||
folder = entryName.substring(0, endIndex);
|
||||
if (folder.endsWith("poi")) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user