File tree Expand file tree Collapse file tree 2 files changed +1
-16
lines changed
src/main/kotlin/com/coder/toolbox Expand file tree Collapse file tree 2 files changed +1
-16
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import com.coder.toolbox.util.SemVer
7
7
import com.coder.toolbox.util.getHeaders
8
8
import com.coder.toolbox.util.getOS
9
9
import com.coder.toolbox.util.sha1
10
- import com.coder.toolbox.util.withLastSegment
11
10
import okhttp3.ResponseBody
12
11
import retrofit2.Response
13
12
import java.io.FileInputStream
@@ -154,7 +153,7 @@ class CoderDownloadService(
154
153
}
155
154
156
155
private suspend fun downloadSignature (url : URL , showTextProgress : (String ) -> Unit ): DownloadResult {
157
- val signatureURL = url.withLastSegment( context.settingsStore.defaultSignatureNameByOsAndArch)
156
+ val signatureURL = url.toURI().resolve( context.settingsStore.defaultSignatureNameByOsAndArch).toURL( )
158
157
val localSignaturePath = localBinaryPath.parent.resolve(context.settingsStore.defaultSignatureNameByOsAndArch)
159
158
context.logger.info(" Downloading signature from $signatureURL " )
160
159
Original file line number Diff line number Diff line change @@ -13,20 +13,6 @@ fun URL.withPath(path: String): URL = URL(
13
13
if (path.startsWith(" /" )) path else " /$path " ,
14
14
)
15
15
16
- fun URL.withLastSegment (segment : String ): URL {
17
- val uri = this .toURI()
18
- val basePath = uri.path.substringBeforeLast(' /' )
19
- val newPath = " $basePath /$segment "
20
- val newUri = URI (
21
- uri.scheme,
22
- uri.authority,
23
- newPath,
24
- uri.query,
25
- uri.fragment
26
- )
27
- return newUri.toURL()
28
- }
29
-
30
16
/* *
31
17
* Return the host, converting IDN to ASCII in case the file system cannot
32
18
* support the necessary character set.
You can’t perform that action at this time.
0 commit comments