Skip to content

Commit fb70b98

Browse files
committed
fix last commit
1 parent 7a45307 commit fb70b98

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies {
3838
compile 'com.google.guava:guava:14.0'
3939
compile 'org.tukaani:xz:1.3'
4040
compile 'net.minecraft:launchwrapper:1.9'
41-
compile 'utybo:minkj:1.0'
41+
compile 'utybo:minkj:1.0'
4242
}
4343

4444
task fatJar(type: Jar, dependsOn: jar) {

build.gradle~

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repositories {
2828

2929
group = 'net.minecraftforgefrance'
3030
archivesBaseName = 'installer'
31-
version = '1.0.8'
31+
version = '1.0.9'
3232
targetCompatibility = '1.6'
3333
sourceCompatibility = '1.6'
3434

src/main/java/fr/minecraftforgefrance/common/DownloadMod.java

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package fr.minecraftforgefrance.common;
22

33
import java.net.URL;
4-
import java.net.URLEncoder;
54
import java.util.List;
65

76
import javax.xml.parsers.DocumentBuilder;
@@ -43,8 +42,8 @@ public void getRemoteList(List<FileEntry> list, List<String> dir)
4342
if(size > 0L)
4443
{
4544
String name = key.substring(key.lastIndexOf("/") + 1);
46-
String path = key.substring(0, key.lastIndexOf("/") +1);
47-
String link = RemoteInfoReader.instance().getSyncUrl() + path + URLEncoder.encode(name, "UTF-8");
45+
String path = key.substring(0, key.lastIndexOf("/") + 1);
46+
String link = RemoteInfoReader.instance().getSyncUrl() + path + escapeURIPathParam(name);
4847
list.add(new FileEntry(new URL(link), md5, key, size));
4948
}
5049
else if(key.split("/").length == 1)
@@ -67,4 +66,35 @@ public static DownloadMod instance()
6766
{
6867
return instance;
6968
}
69+
70+
public static String escapeURIPathParam(String input)
71+
{
72+
StringBuilder resultStr = new StringBuilder();
73+
for(char ch : input.toCharArray())
74+
{
75+
if(isUnsafe(ch))
76+
{
77+
resultStr.append('%');
78+
resultStr.append(toHex(ch / 16));
79+
resultStr.append(toHex(ch % 16));
80+
}
81+
else
82+
{
83+
resultStr.append(ch);
84+
}
85+
}
86+
return resultStr.toString();
87+
}
88+
89+
private static char toHex(int ch)
90+
{
91+
return (char)(ch < 10 ? '0' + ch : 'A' + ch - 10);
92+
}
93+
94+
private static boolean isUnsafe(char ch)
95+
{
96+
if(ch > 128 || ch < 0)
97+
return true;
98+
return " %$&+,/:;=?@<>#%".indexOf(ch) >= 0;
99+
}
70100
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"remoteUrl": "http://dl.mcnanotech.fr/FFMT/installer/demo/remote_info.json"
2+
"remoteUrl": "http://stratiznetwork.olympe.in/Installeur/remote_info.json"
33
}

0 commit comments

Comments
 (0)