Parcourir la source

fixed urls to local files

sirekanian il y a 3 ans
Parent
commit
90c43c9711
1 fichiers modifiés avec 4 ajouts et 4 suppressions
  1. 4 4
      src/main/kotlin/com/sirekanyan/bump/VersionChecker.kt

+ 4 - 4
src/main/kotlin/com/sirekanyan/bump/VersionChecker.kt

@@ -47,16 +47,16 @@ class VersionChecker(
     private fun CoroutineScope.downloadMetadataAsync(key: ArtifactKey): Deferred<String?> =
         async(Dispatchers.IO) {
             try {
-                val url = Url(key.url)
-                if (url.protocol.name == "file") {
-                    val file = File(url.fullPath)
+                if (key.url.startsWith("file:/")) {
+                    val path = key.url.replace(Regex("^file:/+"), "/")
+                    val file = File(path)
                     if (file.exists()) {
                         file.readText()
                     } else {
                         null
                     }
                 } else {
-                    httpClient.get<String>(url)
+                    httpClient.get<String>(key.url)
                 }
             } catch (exception: ClientRequestException) {
                 if (exception.response.status.value == 404) {