From a81c021204bcc46241ba9f1c2290f392d8bf8df2 Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Sat, 2 Mar 2019 01:48:56 -0800 Subject: extension: Truncate long tab titles. Move Apple Double logic. --- extension/background.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'extension') diff --git a/extension/background.js b/extension/background.js index 7be7aa4..73bb579 100644 --- a/extension/background.js +++ b/extension/background.js @@ -84,7 +84,7 @@ const router = { "by-title": { async readdir() { const tabs = await queryTabs(); - return tabs.map(tab => sanitize(String(tab.title)) + "_" + String(tab.id)); + return tabs.map(tab => sanitize(String(tab.title).slice(0, 200)) + "_" + String(tab.id)); }, "*": { async getattr(path) { @@ -176,8 +176,6 @@ const router = { const tabId = parseInt(pathComponent(path, -3)); const suffix = pathComponent(path, -1); - if (suffix.startsWith("._")) throw new UnixError(unix.ENOTSUP); - if (!debugged[tabId]) throw new UnixError(unix.EIO); await sendDebuggerCommand(tabId, "Page.enable", {}); @@ -208,7 +206,11 @@ const router = { function findRoute(path) { let route = router; - for (let segment of path.split("/")) { + let pathSegments = path.split("/"); + if (pathSegments[pathSegments.length - 1].startsWith("._")) { + throw new UnixError(unix.ENOTSUP); // Apple Double file for xattrs + } + for (let segment of pathSegments) { if (segment === "") continue; route = route[segment] || route["*"]; -- cgit v1.2.3