Skip to content

Commit bb36401

Browse files
author
Fahad Israr
committed
make url decoding limited to blob
1 parent c003f42 commit bb36401

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

cli/src/main/java/dev/starfix/Starfix.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ public int config() throws Exception {
4545

4646
@Command(name = "clone")
4747
public int cloneCmd(@Parameters(index = "0") String url) {
48-
try{
49-
url = URLDecoder.decode(url,"UTF-8");
50-
}catch(UnsupportedEncodingException e){
51-
throw new IllegalStateException(e.getMessage(), e);
52-
}
53-
5448
if (url.startsWith("ide://")) {
5549
// stripping out ide:// to simplify launcher scripts.
5650
url = url.substring(6);
@@ -98,9 +92,9 @@ public int cloneCmd(@Parameters(index = "0") String url) {
9892
String temp = url.substring(url.indexOf("blob/")+5);
9993
branch = temp.substring(0,temp.indexOf("/"));
10094
filePath = temp.substring(temp.indexOf("/")+1);
95+
filePath = URLDecoder.decode(filePath,"UTF-8");
10196
url = url.substring(0,url.indexOf("/blob"));
10297
}
103-
10498
URI uri = new URI(url);
10599

106100
// extract name of repository
@@ -109,7 +103,6 @@ public int cloneCmd(@Parameters(index = "0") String url) {
109103

110104
String originUrl = url;
111105
Path directory = Paths.get(clone_path, repo_name);
112-
113106
if (!Files.exists(directory)) // Check if the user cloned the repo previously and in that case no cloning is
114107
// needed
115108
gitClone(directory, originUrl);

0 commit comments

Comments
 (0)