From d6398548439dbbba1d52584ba6469119d88d3857 Mon Sep 17 00:00:00 2001 From: ligi Date: Wed, 8 Feb 2023 18:59:54 +0100 Subject: [PATCH] Make sure icon is json (#2245) One slipped as seen in #2243 MUST be merged after #2243 --- .../src/main/kotlin/org/ethereum/lists/chains/Main.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt b/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt index 1ef364c4..94d9d755 100644 --- a/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt +++ b/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt @@ -82,7 +82,12 @@ private fun createOutputFiles() { .forEach { iconLocation -> val jsonData = Klaxon().parseJsonArray(iconLocation.reader()) - val iconName = iconLocation.toString().replace("../_data/icons/", "").replace(".json", "") + + if (iconLocation.extension != "json") { + error("Icon must be json " + iconLocation) + } + + val iconName = iconLocation.toString().removePrefix("../_data/icons/").removeSuffix(".json") val iconJson = JsonObject() iconJson["name"] = iconName