diff --git a/src/pages/fileBrowser/fileBrowser.js b/src/pages/fileBrowser/fileBrowser.js
index f3806f994..cfe5c0675 100644
--- a/src/pages/fileBrowser/fileBrowser.js
+++ b/src/pages/fileBrowser/fileBrowser.js
@@ -1333,14 +1333,16 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
* @param {String} url
*/
function pushToNavbar(name, url, action) {
+ if (!url) return;
+ const displayName = name || Url.basename(url) || url;
$navigation.append(
,
);
@@ -1359,14 +1361,20 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
* @param {Array} states
*/
function loadStates(states) {
- if (!Array.isArray(states)) return;
+ if (!Array.isArray(states) || !states.length) return;
const backNavigation = [];
- const { url, name } = states.pop();
+ const lastState = states.pop();
+ if (!lastState || !lastState.url) return;
+ const { url } = lastState;
+ const name = lastState.name || Url.basename(url) || url;
let { url: lastUrl, name: lastName } = currentDir;
while (states.length) {
const location = states.splice(0, 1)[0];
+ if (!location || !location.url) {
+ continue;
+ }
const { url, name } = location;
let action;
diff --git a/src/plugins/system/android/com/foxdebug/system/System.java b/src/plugins/system/android/com/foxdebug/system/System.java
index daff3eb66..087ef1d16 100644
--- a/src/plugins/system/android/com/foxdebug/system/System.java
+++ b/src/plugins/system/android/com/foxdebug/system/System.java
@@ -691,14 +691,29 @@ private void hasPermission(String permission, CallbackContext callback) {
}
public boolean fileExists(String path, String countSymlinks) {
- Path p = new File(path).toPath();
+ boolean followSymlinks = !Boolean.parseBoolean(countSymlinks);
+ File file = new File(path);
+
+ // Android < O does not implement File#toPath(), fall back to legacy checks
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+ if (!file.exists()) return false;
+ if (followSymlinks) {
+ try {
+ // If canonical and absolute paths differ, it's a symlink
+ return file.getCanonicalPath().equals(file.getAbsolutePath());
+ } catch (IOException ignored) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ Path p = file.toPath();
try {
- if (Boolean.parseBoolean(countSymlinks)) {
- // This will return true even for broken symlinks
- return Files.exists(p, LinkOption.NOFOLLOW_LINKS);
- } else {
- // Check target file, not symlink itself
+ if (followSymlinks) {
return Files.exists(p) && !Files.isSymbolicLink(p);
+ } else {
+ return Files.exists(p, LinkOption.NOFOLLOW_LINKS);
}
} catch (Exception e) {
return false;
@@ -1301,4 +1316,4 @@ private void setInputType(String type) {
}
webView.setInputType(mode);
}
-}
\ No newline at end of file
+}
diff --git a/src/plugins/websocket/www/websocket.js b/src/plugins/websocket/www/websocket.js
index f1d1e93b1..acf883149 100644
--- a/src/plugins/websocket/www/websocket.js
+++ b/src/plugins/websocket/www/websocket.js
@@ -58,13 +58,21 @@ class WebSocketInstance extends EventTarget {
if (event.type === 'close') {
this.readyState = WebSocketInstance.CLOSED;
- const closeEvent = new CloseEvent('close', { code: event.data?.code, reason: event.data?.reason });
+ const closeData = event && event.data ? event.data : {};
+ const closeEvent = new CloseEvent('close', {
+ code: closeData.code,
+ reason: closeData.reason,
+ });
if (this.onclose) this.onclose(closeEvent);
this.dispatchEvent(closeEvent);
}
if (event.type === 'error') {
- const errorEvent = new Event('error', { message: event?.data });
+ const errorMessage = event && event.data ? event.data : undefined;
+ const errorEvent = new Event('error');
+ if (errorMessage !== undefined) {
+ errorEvent.message = errorMessage;
+ }
if (this.onerror) this.onerror(errorEvent);
this.dispatchEvent(errorEvent);
}
diff --git a/www/index.html b/www/index.html
index fdbb95a01..e305fb525 100644
--- a/www/index.html
+++ b/www/index.html
@@ -47,7 +47,7 @@
type,
listener,
useCapture,
- allowed,
+ allowed
) {
if (typeof useCapture === "boolean") {
allowed = useCapture;
@@ -76,7 +76,7 @@
}
this.eventListeners[type].push({
listener: listener,
- useCapture: useCapture,
+ useCapture: useCapture
});
return;
@@ -159,4 +159,4 @@