Fix github archive directory prefix structure logic
This commit is contained in:
@@ -30,7 +30,7 @@ public class ImportConfig {
|
|||||||
"https://github.com/foundryvtt/pf2e/archive/refs/heads/master.zip",
|
"https://github.com/foundryvtt/pf2e/archive/refs/heads/master.zip",
|
||||||
"com.majinnaibu.monstercards.importers.Pf2eImporter",
|
"com.majinnaibu.monstercards.importers.Pf2eImporter",
|
||||||
".json",
|
".json",
|
||||||
"packs/pf2e"
|
"pf2e-master/packs/"
|
||||||
));
|
));
|
||||||
|
|
||||||
SOURCES.add(new ImportSource(
|
SOURCES.add(new ImportSource(
|
||||||
@@ -42,7 +42,7 @@ public class ImportConfig {
|
|||||||
"https://github.com/foundryvtt/pf2e/archive/refs/heads/master.zip",
|
"https://github.com/foundryvtt/pf2e/archive/refs/heads/master.zip",
|
||||||
"com.majinnaibu.monstercards.importers.Pf2eImporter",
|
"com.majinnaibu.monstercards.importers.Pf2eImporter",
|
||||||
".json",
|
".json",
|
||||||
"packs/sf2e"
|
"pf2e-master/packs/sf2e"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,8 @@ public class GitRepoImporterService {
|
|||||||
if (isCancelled.getAsBoolean()) break;
|
if (isCancelled.getAsBoolean()) break;
|
||||||
if (file.isFile()) {
|
if (file.isFile()) {
|
||||||
String content = readFileContent(file);
|
String content = readFileContent(file);
|
||||||
if (content != null && importer.canImport(content)) {
|
if (content != null) {
|
||||||
|
if (importer.canImport(content)) {
|
||||||
try {
|
try {
|
||||||
Monster monster = importer.parse(content);
|
Monster monster = importer.parse(content);
|
||||||
repository.saveMonster(monster).blockingAwait();
|
repository.saveMonster(monster).blockingAwait();
|
||||||
@@ -154,6 +155,11 @@ public class GitRepoImporterService {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.logError("Failed to parse/save monster from file: " + file.getName(), e);
|
Logger.logError("Failed to parse/save monster from file: " + file.getName(), e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Logger.logWTF("Importer rejected file: " + file.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Logger.logError("Failed to read content from file: " + file.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user