Skip to content

Commit

Permalink
fix stylesheet content-type fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vendicated committed Jan 4, 2023
1 parent a31d92f commit ac4e05e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/dev/vendicated/vencord/VWebviewClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void onPageFinished(WebView view, String url) {
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest req) {
var uri = req.getUrl();
if (req.isForMainFrame() || req.getUrl().getHost().equals("raw.githubusercontent.com") && req.getUrl().getPath().endsWith(".css")) {
if (req.isForMainFrame() || req.getUrl().getPath().endsWith(".css")) {
try {
return doFetch(req);
} catch (IOException ex) {
Expand Down Expand Up @@ -71,6 +71,6 @@ private WebResourceResponse doFetch(WebResourceRequest req) throws IOException {
}
if (url.endsWith(".css")) modifiedHeaders.put("Content-Type", "text/css");

return new WebResourceResponse(conn.getHeaderField("Content-Type"), "utf-8", code, msg, modifiedHeaders, conn.getInputStream());
return new WebResourceResponse(modifiedHeaders.getOrDefault("Content-Type", "application/octet-stream"), "utf-8", code, msg, modifiedHeaders, conn.getInputStream());
}
}

0 comments on commit ac4e05e

Please sign in to comment.