Skip to content

Commit

Permalink
Merge pull request #1166 from nageslan/dev
Browse files Browse the repository at this point in the history
Add origin download source, fix invalid URL
  • Loading branch information
TSaltedfishKing authored Jun 9, 2023
2 parents ac420bc + cecd8cc commit af10921
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,23 @@ public String getSourceUrl(String sourceName, String type) {
}

public String getFileUrl(String originUrl, String sourceName, String type) {
if ("origin".equals(sourceName)){
return originUrl;
}
String convertedUrl;
StringBuilder Str1 = new StringBuilder();
String Str2 = getSourceUrl(SettingJson.DOWNLOAD_SOURCE_OFFICIAL, type);
for (int i = Str2.length(); i < originUrl.length(); i++) {
Str1.append(originUrl.charAt(i));
}
convertedUrl = getSourceUrl(sourceName, type) + Str1;
// 修复者 nageslan: 修复了下载游戏版本直接报错的问题, 因为下载的时候SourceUrl 没有戴 "/" 符号, 而且Str1也没有"/"符号前缀,导致直接修改了域名
String url = Str1.toString();
if (!"".equals(url)){
if (!url.startsWith("/")){
url = "/" +url.substring(1);
}
}
convertedUrl = getSourceUrl(sourceName, type) + url;
return convertedUrl;
}
}
3 changes: 2 additions & 1 deletion app/src/main/res/values/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
</string-array>
<string-array name="download_type">
<item>origin</item>
<item>official</item>
<item>bmclapi</item>
<item>mcbbs</item>
</string-array>

</resources>
</resources>

0 comments on commit af10921

Please sign in to comment.