Skip to content

Commit 1b86950

Browse files
authored
Merge pull request #2803 from sturdy4days/refactor/remove-dead-resolvegroupipcpath
refactor: remove dead resolveGroupIpcPath
2 parents 7e2004f + 8b435eb commit 1b86950

2 files changed

Lines changed: 2 additions & 16 deletions

File tree

src/group-folder.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'path';
22

33
import { describe, expect, it } from 'vitest';
44

5-
import { isValidGroupFolder, resolveGroupFolderPath, resolveGroupIpcPath } from './group-folder.js';
5+
import { isValidGroupFolder, resolveGroupFolderPath } from './group-folder.js';
66

77
describe('group folder validation', () => {
88
it('accepts normal group folder names', () => {
@@ -23,13 +23,7 @@ describe('group folder validation', () => {
2323
expect(resolved.endsWith(`${path.sep}groups${path.sep}family-chat`)).toBe(true);
2424
});
2525

26-
it('resolves safe paths under data ipc directory', () => {
27-
const resolved = resolveGroupIpcPath('family-chat');
28-
expect(resolved.endsWith(`${path.sep}data${path.sep}ipc${path.sep}family-chat`)).toBe(true);
29-
});
30-
3126
it('throws for unsafe folder names', () => {
3227
expect(() => resolveGroupFolderPath('../../etc')).toThrow();
33-
expect(() => resolveGroupIpcPath('/tmp')).toThrow();
3428
});
3529
});

src/group-folder.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path';
22

3-
import { DATA_DIR, GROUPS_DIR } from './config.js';
3+
import { GROUPS_DIR } from './config.js';
44

55
const GROUP_FOLDER_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
66
const RESERVED_FOLDERS = new Set(['global']);
@@ -34,11 +34,3 @@ export function resolveGroupFolderPath(folder: string): string {
3434
ensureWithinBase(GROUPS_DIR, groupPath);
3535
return groupPath;
3636
}
37-
38-
export function resolveGroupIpcPath(folder: string): string {
39-
assertValidGroupFolder(folder);
40-
const ipcBaseDir = path.resolve(DATA_DIR, 'ipc');
41-
const ipcPath = path.resolve(ipcBaseDir, folder);
42-
ensureWithinBase(ipcBaseDir, ipcPath);
43-
return ipcPath;
44-
}

0 commit comments

Comments
 (0)