Skip to content

Android: Disable setAllowFileAccess in NewsblurWebview#2110

Open
jim-daf wants to merge 1 commit into
samuelclay:mainfrom
jim-daf:fix-android-webview-file-access
Open

Android: Disable setAllowFileAccess in NewsblurWebview#2110
jim-daf wants to merge 1 commit into
samuelclay:mainfrom
jim-daf:fix-android-webview-file-access

Conversation

@jim-daf

@jim-daf jim-daf commented May 13, 2026

Copy link
Copy Markdown

Closes #2109.

NewsblurWebview already integrates WebViewAssetLoader for bundled resources, and ReadingItemFragment loads articles with the https appassets virtual host:

// AppConstants.java
public final static String READING_BASE_URL = "https://appassets.androidplatform.net/assets/";

// NewsblurWebview.java
class NewsblurWebViewClient extends WebViewClient {
    @Override
    public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
        return assetLoader.shouldInterceptRequest(request.getUrl());
    }
    ...
}

The reading WebView never loads a file:// URL as the main frame, and asset requests are served by assetLoader.shouldInterceptRequest, which reads from the AssetManager regardless of setAllowFileAccess.

Change

In NewsblurWebview constructor, flip setAllowFileAccess(true) to setAllowFileAccess(false). Short inline comment recording the asset-loader rationale.

The asset-loader pathway is unaffected. The change is contained to the Android client.

Assisted-by: Claude (Anthropic)

NewsblurWebview already serves bundled assets through
WebViewAssetLoader (see NewsblurWebViewClient.shouldInterceptRequest
and setAssetLoader). The reading WebView is loaded with
READING_BASE_URL = "https://appassets.androidplatform.net/assets/",
which is the standard virtual host that WebViewAssetLoader uses to
serve android_asset over https. The page never has a file:// URL
in its address bar or as the main frame.

setAllowFileAccess(true) is therefore not load-bearing here. Flip
it to false. The asset loader pathway is unaffected because
shouldInterceptRequest serves resources directly from the
AssetManager and does not consult this flag.

Assisted-by: Claude (Anthropic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: NewsblurWebview enables setAllowFileAccess while loading https appassets virtual host

1 participant