From 7f4a0f60fce3524dfe283750db00915ae7ed56a3 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 2 Mar 2020 09:02:02 +1100 Subject: [PATCH] Allow "-" in package names + fix bug scanning root folder --- .../main/java/org/hl7/fhir/utilities/cache/NpmPackage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java index e1ecfedbc..e2abec238 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java @@ -77,7 +77,7 @@ import com.google.gson.JsonObject; public class NpmPackage { public static boolean isValidName(String pid) { - return pid.matches("^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)+$"); + return pid.matches("^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9\\-]*)+$"); } public static boolean isValidVersion(String ver) { @@ -826,7 +826,7 @@ public class NpmPackage { public void loadAllFiles() throws IOException { for (String folder : folders.keySet()) { NpmPackageFolder pf = folders.get(folder); - String p = Utilities.path(path, folder); + String p = folder.contains("$") ? path : Utilities.path(path, folder); for (File f : new File(p).listFiles()) { if (!f.isDirectory()) { pf.getContent().put(f.getName(), TextFile.fileToBytes(f));