Skip to content

Commit fac65c6

Browse files
authored
Merge pull request #74 from fahad-israr/fileName-with-space-patch
Patch : To handle file names with spaces.
2 parents 57c9701 + bb36401 commit fac65c6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
import picocli.CommandLine.ExitCode;
1515
import picocli.CommandLine.Parameters;
1616

17+
import java.io.UnsupportedEncodingException;
1718
import java.io.BufferedReader;
1819
import java.io.IOException;
1920
import java.io.InputStreamReader;
2021
import java.net.URI;
22+
import java.net.URLDecoder;
2123
import java.nio.file.Files;
2224
import java.nio.file.Path;
2325
import 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

Comments
 (0)