Skip to content

Commit

Permalink
fix: simplify method was too simple
Browse files Browse the repository at this point in the history
  • Loading branch information
quintesse committed Feb 22, 2024
1 parent 02a7485 commit d1681c2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/dev/jbang/catalog/Catalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,14 @@ static void check(boolean ok, String message) {
}

public static String simplifyName(String catalog) {
if (catalog.endsWith("/" + JBANG_CATALOG_REPO)) {
return catalog.substring(0, catalog.length() - 14);
if (!Util.isURL(catalog) && !isValidCatalogReference(catalog)) {
if (catalog.endsWith("/" + JBANG_CATALOG_REPO)) {
return catalog.substring(0, catalog.length() - 14);
} else {
return catalog.replace("/" + JBANG_CATALOG_REPO + "~", "~");
}
} else {
return catalog.replace("/" + JBANG_CATALOG_REPO + "~", "~");
return catalog;
}
}

Expand Down

0 comments on commit d1681c2

Please sign in to comment.