From c247c2d99857975e9450228d0d559a03976d2705 Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Tue, 22 Sep 2026 20:50:29 -0700 Subject: [PATCH] Fix github archive directory prefix structure logic --- .../monstercards/data/ImportConfig.java | 4 ++-- .../importers/GitRepoImporterService.java | 20 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Android/app/src/main/java/com/majinnaibu/monstercards/data/ImportConfig.java b/Android/app/src/main/java/com/majinnaibu/monstercards/data/ImportConfig.java index 36554ff..fff62c0 100644 --- a/Android/app/src/main/java/com/majinnaibu/monstercards/data/ImportConfig.java +++ b/Android/app/src/main/java/com/majinnaibu/monstercards/data/ImportConfig.java @@ -30,7 +30,7 @@ public class ImportConfig { "https://github.com/foundryvtt/pf2e/archive/refs/heads/master.zip", "com.majinnaibu.monstercards.importers.Pf2eImporter", ".json", - "packs/pf2e" + "pf2e-master/packs/" )); SOURCES.add(new ImportSource( @@ -42,7 +42,7 @@ public class ImportConfig { "https://github.com/foundryvtt/pf2e/archive/refs/heads/master.zip", "com.majinnaibu.monstercards.importers.Pf2eImporter", ".json", - "packs/sf2e" + "pf2e-master/packs/sf2e" )); } } diff --git a/Android/app/src/main/java/com/majinnaibu/monstercards/importers/GitRepoImporterService.java b/Android/app/src/main/java/com/majinnaibu/monstercards/importers/GitRepoImporterService.java index 55f81d9..5d08b27 100644 --- a/Android/app/src/main/java/com/majinnaibu/monstercards/importers/GitRepoImporterService.java +++ b/Android/app/src/main/java/com/majinnaibu/monstercards/importers/GitRepoImporterService.java @@ -146,14 +146,20 @@ public class GitRepoImporterService { if (isCancelled.getAsBoolean()) break; if (file.isFile()) { String content = readFileContent(file); - if (content != null && importer.canImport(content)) { - try { - Monster monster = importer.parse(content); - repository.saveMonster(monster).blockingAwait(); - importedCount++; - } catch (Exception e) { - Logger.logError("Failed to parse/save monster from file: " + file.getName(), e); + if (content != null) { + if (importer.canImport(content)) { + try { + Monster monster = importer.parse(content); + repository.saveMonster(monster).blockingAwait(); + importedCount++; + } catch (Exception 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()); } } }