Allow explorers starting with http:// :-(

it's sad - but can't really force them to use https://
This commit is contained in:
ligi 2022-11-04 02:12:50 +01:00
parent 2f42e78adb
commit 9c89bcbd2f
3 changed files with 5 additions and 5 deletions

View File

@ -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("/")) {

View File

@ -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")

View File

@ -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)
}