aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/assistant/Files.js
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/assistant/Files.js')
-rw-r--r--desktop/assistant/Files.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/desktop/assistant/Files.js b/desktop/assistant/Files.js
index b7f8c2b..bcfe1f0 100644
--- a/desktop/assistant/Files.js
+++ b/desktop/assistant/Files.js
@@ -45,11 +45,12 @@ function kind(path) {
function chats(k) { return CHAT.includes(k); }
-// A dropped URL to a local path, or "" for anything that is not a file.
+// A dropped URL to a local path, or "" for anything that is not a local
+// file: file:///path, or file://localhost/path; any other host is remote.
function fromUrl(url) {
- const s = String(url);
- if (!s.startsWith("file://")) return "";
- try { return decodeURIComponent(s.slice(7)); } catch (e) { return ""; }
+ const m = /^file:\/\/(localhost)?(\/.*)$/.exec(String(url));
+ if (!m) return "";
+ try { return decodeURIComponent(m[2]); } catch (e) { return ""; }
}
function file(path) { return { path: path, name: name(path), kind: kind(path) }; }