1414import picocli .CommandLine .ExitCode ;
1515import picocli .CommandLine .Parameters ;
1616
17+ import java .io .UnsupportedEncodingException ;
1718import java .io .BufferedReader ;
1819import java .io .IOException ;
1920import java .io .InputStreamReader ;
2021import java .net .URI ;
22+ import java .net .URLDecoder ;
2123import java .nio .file .Files ;
2224import java .nio .file .Path ;
2325import java .nio .file .Paths ;
@@ -50,7 +52,6 @@ public int config() throws Exception {
5052
5153 @ Command (name = "clone" )
5254 public int cloneCmd (@ Parameters (index = "0" ) String url ) {
53-
5455 if (url .startsWith ("ide://" )) {
5556 // stripping out ide:// to simplify launcher scripts.
5657 url = url .substring (6 );
@@ -77,13 +78,12 @@ public int cloneCmd(@Parameters(index = "0") String url) {
7778 if (isBlob (url ))
7879 { // Example URL : https://github.com/starfixdev/starfix/blob/master/cli/pom.xml
7980 // Example URL2: https://github.com/hexsum/Mojo-Webqq/blob/master/script/check_dependencies.pl#L17
80-
8181 String temp = url .substring (url .indexOf ("blob/" )+5 );
8282 branch = temp .substring (0 ,temp .indexOf ("/" ));
8383 filePath = temp .substring (temp .indexOf ("/" )+1 );
84+ filePath = URLDecoder .decode (filePath ,"UTF-8" );
8485 url = url .substring (0 ,url .indexOf ("/blob" ));
8586 }
86-
8787 URI uri = new URI (url );
8888
8989 // extract name of repository
@@ -92,7 +92,6 @@ public int cloneCmd(@Parameters(index = "0") String url) {
9292
9393 String originUrl = url ;
9494 Path directory = Paths .get (clone_path , repo_name );
95-
9695 if (!Files .exists (directory )) // Check if the user cloned the repo previously and in that case no cloning is
9796 // needed
9897 gitClone (directory , originUrl );
0 commit comments