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 c2f01963..0b76dc5c 100644 --- a/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt +++ b/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt @@ -262,8 +262,8 @@ fun checkChain(chainFile: File, connectRPC: Boolean) { } val url = explorer["url"] - if (url == null || url !is String || !url.startsWith("https://")) { - throw (ExplorerMustWithHttps()) + if (url == null || url !is String || !(url.startsWith("https://") || url.startsWith("http://"))) { + throw (ExplorerMustWithHttpsOrHttp()) } if (url.endsWith("/")) { diff --git a/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt b/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt index 839c8d2b..f59f3621 100644 --- a/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt +++ b/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt @@ -17,7 +17,7 @@ class ShortNameMustNotBeStar: Exception("short name must not be '*'") class UnsupportedNamespace: Exception("So far only the EIP155 namespace is supported") class ExplorersMustBeArray: Exception("explorers must be an array") class ExplorerMustHaveName: Exception("Explorer must have name") -class ExplorerMustWithHttps: Exception("Explorer have url starting with https://") +class ExplorerMustWithHttpsOrHttp: Exception("Explorer have url starting with https:// or http://") class ExplorerCannotEndInSlash: Exception("Explorer cannot have a slash on the end") class ExplorerStandardMustBeEIP3091OrNone: Exception("explorer standard must be 'none' or 'EIP3091'") class ParentHasInvalidType(type: String?): Exception("Parent has invalid type $type - only L2 or shard allowed") diff --git a/processor/src/test/kotlin/org/ethereum/lists/chains/TheChainChecker.kt b/processor/src/test/kotlin/org/ethereum/lists/chains/TheChainChecker.kt index e87b2f75..100c1538 100644 --- a/processor/src/test/kotlin/org/ethereum/lists/chains/TheChainChecker.kt +++ b/processor/src/test/kotlin/org/ethereum/lists/chains/TheChainChecker.kt @@ -226,12 +226,12 @@ class TheChainChecker { checkChain(getFile("invalid/explorernoname/eip155-1.json"), false) } - @Test(expected = ExplorerMustWithHttps::class) + @Test(expected = ExplorerMustWithHttpsOrHttp::class) fun shouldFailOnInvalidUrl() { checkChain(getFile("invalid/explorerinvalidurl/eip155-1.json"), false) } - @Test(expected = ExplorerMustWithHttps::class) + @Test(expected = ExplorerMustWithHttpsOrHttp::class) fun shouldFailOnMissingURL() { checkChain(getFile("invalid/explorermissingurl/eip155-1.json"), false) }