[AND] Fixed crash on encoded resources name.

This commit is contained in:
d-kunin 2013-12-18 11:32:47 +03:00
parent 58af67df42
commit 44498382ea
2 changed files with 7 additions and 5 deletions

View file

@ -205,10 +205,10 @@ public class ArticleInfoDetailFragment extends Fragment
if (url.startsWith("file:///"))
{
final InputStream is = mZippedGuidesStorage.getData(url.replace("file:///", "data/"));
return new WebResourceResponse(getActivity().getContentResolver().getType(Uri.parse(url)), "UTF-8", is);
if (is != null)
return new WebResourceResponse(getActivity().getContentResolver().getType(Uri.parse(url)), "UTF-8", is);
}
else
return super.shouldInterceptRequest(view, url);
return super.shouldInterceptRequest(view, url);
}
}

View file

@ -2,6 +2,7 @@ package com.guidewithme.async;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLDecoder;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@ -25,8 +26,9 @@ public class ZippedGuidesStorage
{
try
{
final ZipEntry ze = mZFile.getEntry(url);
return mZFile.getInputStream(ze);
final String decodedUrl = URLDecoder.decode(url, "utf-8");
final ZipEntry ze = mZFile.getEntry(decodedUrl);
return ze == null ? null : mZFile.getInputStream(ze);
}
catch (final IOException e)
{