Procházet zdrojové kódy

fix(tui): match plain absolute paths when resolving sidebar slot order

Source installs are stored as filesystem paths without a file:// prefix.
Basename matching previously applied only to file:// specs, so those
entries fell through to the historic 900. Absolute local paths now
match by basename, same as file:// checkouts.
dhaern před 1 dnem
rodič
revize
33e5051330
2 změnil soubory, kde provedl 8 přidání a 0 odebrání
  1. 4 0
      src/tui.test.ts
  2. 4 0
      src/tui.ts

+ 4 - 0
src/tui.test.ts

@@ -899,6 +899,10 @@ describe('resolveSidebarSlotOrder', () => {
     expect(resolveSidebarSlotOrder([`file:///w/${NAME}/`], NAME)).toBe(110);
   });
 
+  test('plain absolute local paths match by basename', () => {
+    expect(resolveSidebarSlotOrder([`/workspace/${NAME}`], NAME)).toBe(110);
+  });
+
   test('non-string and malformed entries are skipped without shifting index', () => {
     expect(
       resolveSidebarSlotOrder(

+ 4 - 0
src/tui.ts

@@ -711,6 +711,10 @@ export function resolveSidebarSlotOrder(
       const stripped = spec.replace(/^file:\/\//, '');
       return stripped === pluginName || path.basename(stripped) === pluginName;
     }
+    if (path.isAbsolute(spec)) {
+      // Plain local path, as the installer writes for source installs.
+      return path.basename(spec) === pluginName;
+    }
     // npm spec: strip a trailing @version (never contains a slash). A
     // scoped package (@scope/name) is a different package and must not
     // match by basename.