This repository was archived by the owner on May 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
app/src/main/java/com/fox2code/mmm/markdown Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1717import com .fox2code .mmm .utils .Http ;
1818import com .fox2code .mmm .utils .IntentHelper ;
1919
20+ import java .io .IOException ;
2021import java .nio .charset .StandardCharsets ;
2122
2223
@@ -60,7 +61,18 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
6061 new Thread (() -> {
6162 try {
6263 Log .d (TAG , "Downloading" );
63- String markdown = new String (Http .doHttpGet (url , true ), StandardCharsets .UTF_8 );
64+ byte [] rawMarkdown ;
65+ try {
66+ rawMarkdown = Http .doHttpGet (url , true );
67+ } catch (IOException e ) {
68+ // Workaround GitHub README.md case sensitivity issue
69+ if (url .startsWith ("https://raw.githubusercontent.com/" ) &&
70+ url .endsWith ("/README.md" )) { // Try with lowercase version
71+ rawMarkdown = Http .doHttpGet (url .substring (0 ,
72+ url .length () - 9 ) + "readme.md" , true );
73+ } else throw e ;
74+ }
75+ String markdown = new String (rawMarkdown , StandardCharsets .UTF_8 );
6476 Log .d (TAG , "Done!" );
6577 runOnUiThread (() -> {
6678 MainApplication .getINSTANCE ().getMarkwon ().setMarkdown (
You can’t perform that action at this time.
0 commit comments