mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 15:27:55 -04:00
android fix issue #445 "Blank pages on Android"
zimlib does not correctly handle fragments (#...), strip them in java for now. Note that besides rotation/reload bug also lead to blank page if clicked link contains fragment (and is not same page)
This commit is contained in:
parent
67e7eee592
commit
ee19d5b834
@ -189,11 +189,18 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
Log.d("zimgap",
|
Log.d("zimgap",
|
||||||
"Retrieving :"
|
"Retrieving :"
|
||||||
+ articleUri.toString());
|
+ articleUri.toString());
|
||||||
|
|
||||||
String t = articleUri.toString();
|
String t = articleUri.toString();
|
||||||
int pos = articleUri.toString().indexOf(CONTENT_URI.toString());
|
int pos = articleUri.toString().indexOf(CONTENT_URI.toString());
|
||||||
if (pos != -1)
|
if (pos != -1)
|
||||||
t = articleUri.toString().substring(
|
t = articleUri.toString().substring(
|
||||||
CONTENT_URI.toString().length());
|
CONTENT_URI.toString().length());
|
||||||
|
// Remove fragment (#...) as not supported by zimlib
|
||||||
|
pos = t.indexOf("#");
|
||||||
|
if (pos != -1) {
|
||||||
|
t = t.substring(0, pos);
|
||||||
|
}
|
||||||
|
|
||||||
this.out = out;
|
this.out = out;
|
||||||
this.articleZimUrl = t;
|
this.articleZimUrl = t;
|
||||||
}
|
}
|
||||||
@ -223,7 +230,7 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
Log.d("zimgap", "reading " + articleZimUrl
|
Log.d("zimgap", "reading " + articleZimUrl
|
||||||
+ " finished.");
|
+ "(mime "+mime.value+", size: "+size.value+") finished.");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(getClass().getSimpleName(), "Exception reading article "
|
Log.e(getClass().getSimpleName(), "Exception reading article "
|
||||||
+ articleZimUrl + " from zim file", e);
|
+ articleZimUrl + " from zim file", e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user