mirror of
https://github.com/osnr/TabFS.git
synced 2024-05-17 21:16:35 +02:00
extension: Truncate long tab titles. Move Apple Double logic.
This commit is contained in:
parent
aa3ac637ee
commit
a81c021204
|
@ -84,7 +84,7 @@ const router = {
|
||||||
"by-title": {
|
"by-title": {
|
||||||
async readdir() {
|
async readdir() {
|
||||||
const tabs = await queryTabs();
|
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) {
|
async getattr(path) {
|
||||||
|
@ -176,8 +176,6 @@ const router = {
|
||||||
const tabId = parseInt(pathComponent(path, -3));
|
const tabId = parseInt(pathComponent(path, -3));
|
||||||
const suffix = pathComponent(path, -1);
|
const suffix = pathComponent(path, -1);
|
||||||
|
|
||||||
if (suffix.startsWith("._")) throw new UnixError(unix.ENOTSUP);
|
|
||||||
|
|
||||||
if (!debugged[tabId]) throw new UnixError(unix.EIO);
|
if (!debugged[tabId]) throw new UnixError(unix.EIO);
|
||||||
|
|
||||||
await sendDebuggerCommand(tabId, "Page.enable", {});
|
await sendDebuggerCommand(tabId, "Page.enable", {});
|
||||||
|
@ -208,7 +206,11 @@ const router = {
|
||||||
|
|
||||||
function findRoute(path) {
|
function findRoute(path) {
|
||||||
let route = router;
|
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;
|
if (segment === "") continue;
|
||||||
route = route[segment] || route["*"];
|
route = route[segment] || route["*"];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue