aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Rizwan <omar.rizwan@gmail.com>2019-03-02 01:48:56 -0800
committerOmar Rizwan <omar.rizwan@gmail.com>2019-03-02 01:48:56 -0800
commita81c021204bcc46241ba9f1c2290f392d8bf8df2 (patch)
treea087c04eeed55cc6ccd55df65ac1b5d52211043a
parentaa3ac637ee3749f4d0fcdd3a39b861b0d969fce7 (diff)
extension: Truncate long tab titles. Move Apple Double logic.
-rw-r--r--extension/background.js10
1 files changed, 6 insertions, 4 deletions
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["*"];