Created by: coreydowning
We noticed a bug while using Ion for some file downloading and traced it down to the URI getting decoded in the GET string. You can reproduce the error we saw in Ion using something like the following:
Ion.with(context).load("http://jpkc.seiee.sjtu.edu.cn/ds/ds2/Course%20lecture/chapter%2010.pdf")
.setLogging("IonSample", Log.DEBUG)
.write(new File(context.getCacheDir(), "foo")).withResponse()
.setCallback(new FutureCallback<Response<File>>() {
@Override
public void onCompleted(Exception e, Response<File> result) {
if (e != null) {
logger.writeLine("ERROR " + e.getMessage());
} else {
RawHeaders headers = result.getHeaders();
if (headers.getResponseCode() != 200) {
logger.writeLine("Got a bad response code :( " + headers.getResponseCode() + ": " + headers.getResponseMessage());
} else {
logger.writeLine("Success!");
}
}
}
});
AndroidAsync was making GETs with spaces in them which is invalid.