Skip to content

Commit

Permalink
null-encoding is fine for WebResourceResponse()
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Apr 20, 2023
1 parent 74e7f1a commit 0f24c25
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/org/thoughtcrime/securesms/FullMsgActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,21 +175,15 @@ protected WebResourceResponse interceptRequest(String url) {
if (url == null) {
throw new Exception("no url specified");
}

DcHttpResponse httpResponse = dcContext.getHttpResponse(url);
if (httpResponse == null) {
throw new Exception(dcContext.getLastError());
}

String mimeType = httpResponse.getMimetype();
if (mimeType == null) {
mimeType = "application/octet-stream";
}
String encoding = httpResponse.getEncoding();
if (encoding == null) {
encoding = "UTF-8";
}
res = new WebResourceResponse(mimeType, encoding, new ByteArrayInputStream(httpResponse.getBlob()));
res = new WebResourceResponse(mimeType, httpResponse.getEncoding(), new ByteArrayInputStream(httpResponse.getBlob()));
} catch (Exception e) {
e.printStackTrace();
res = new WebResourceResponse("text/plain", "UTF-8", new ByteArrayInputStream(("Error: " + e.getMessage()).getBytes()));
Expand Down

0 comments on commit 0f24c25

Please sign in to comment.