Capacitor Version
馃拪 Capacitor Doctor 馃拪
Latest Dependencies:
@capacitor/cli: 8.5.0
@capacitor/core: 8.5.0
@capacitor/android: 8.5.0
@capacitor/ios: 8.5.0
Installed Dependencies:
@capacitor/cli: 8.4.1
@capacitor/core: 8.4.1
@capacitor/android: 8.4.2
@capacitor/ios: 8.4.1
[success] iOS looking great! 馃憣
[success] Android looking great! 馃憣
Other API Details
npm version: 11.18.0
node version: v24.12.0
Platforms Affected
Current Behavior
When I fetch() a local data file that is included under webDir, and the filename doesn't have a "." (dot) in it, the fetch() returns the /index.html file instead, every time. As long as the filename has a "." in it, the correct file is returned.
Expected Behavior
A fetch() should get the correct file from under webDir regardless of whether the filename has an extension or not.
Project Reproduction
hoping the bug isolation below precludes the need for a test case....
Additional Information
I'm guessing the bug is in handleLocalRequest() in WebViewLocalServer.java. Line 374 is:
if (isLocalFile(request.getUrl()) || isErrorUrl(request.getUrl())) {
Is this supposed to detect if the URL points to a file under webDir? isLocalFile() just tests for the URL path starting with either capacitorContentStart or capacitorFileStart, which come from constants in Bridge.java, but the request URL doesn't start with either of those. Instead of executing this block, it skips over and passes the test on line 399, which is:
if (path.equals("/") || (!request.getUrl().getLastPathSegment().contains(".") && html5mode)) {
... thus returning /index.html. (I don't know why the .contains(".") test is in there, or what html5mode is.)
Capacitor Version
馃拪 Capacitor Doctor 馃拪
Latest Dependencies:
@capacitor/cli: 8.5.0
@capacitor/core: 8.5.0
@capacitor/android: 8.5.0
@capacitor/ios: 8.5.0
Installed Dependencies:
@capacitor/cli: 8.4.1
@capacitor/core: 8.4.1
@capacitor/android: 8.4.2
@capacitor/ios: 8.4.1
[success] iOS looking great! 馃憣
[success] Android looking great! 馃憣
Other API Details
Platforms Affected
Current Behavior
When I
fetch()a local data file that is included underwebDir, and the filename doesn't have a "." (dot) in it, thefetch()returns the/index.htmlfile instead, every time. As long as the filename has a "." in it, the correct file is returned.Expected Behavior
A
fetch()should get the correct file from underwebDirregardless of whether the filename has an extension or not.Project Reproduction
hoping the bug isolation below precludes the need for a test case....
Additional Information
I'm guessing the bug is in
handleLocalRequest()inWebViewLocalServer.java. Line 374 is:Is this supposed to detect if the URL points to a file under
webDir?isLocalFile()just tests for the URL path starting with eithercapacitorContentStartorcapacitorFileStart, which come from constants inBridge.java, but the request URL doesn't start with either of those. Instead of executing this block, it skips over and passes the test on line 399, which is:... thus returning
/index.html. (I don't know why the.contains(".")test is in there, or whathtml5modeis.)