1
0
Fork 0

fix stylesheet content-type fix

This commit is contained in:
Vendicated 2023-01-04 01:13:56 +01:00
parent a31d92f795
commit ac4e05e9f2
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -41,7 +41,7 @@ public class VWebviewClient extends WebViewClient {
@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) {
@ -71,6 +71,6 @@ public class VWebviewClient extends WebViewClient {
}
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());
}
}