mirror of
https://github.com/stablyai/orca.git
synced 2026-10-12 08:02:37 +00:00
Handle forward-slash UNC terminal paths
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
committed by
Neil
co-authored by
Orca
parent
6be0d6b275
commit
a3195fa36f
@@ -4,7 +4,9 @@ import { resolveTerminalFileUrlTarget } from './terminal-file-url-target'
|
||||
describe('resolveTerminalFileUrlTarget', () => {
|
||||
it('resolves UNC file URLs with line and column anchors', () => {
|
||||
expect(
|
||||
resolveTerminalFileUrlTarget(new URL('file://Server/Share/Repo/src/app.ts#L12C3'))
|
||||
resolveTerminalFileUrlTarget(new URL('file://Server/Share/Repo/src/app.ts#L12C3'), {
|
||||
allowUncHost: true
|
||||
})
|
||||
).toEqual({
|
||||
filePath: '//server/Share/Repo/src/app.ts',
|
||||
line: 12,
|
||||
|
||||
@@ -501,6 +501,38 @@ describe('handleOscLink', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('opens UNC file URL links with line and column anchors', async () => {
|
||||
setPlatform('Windows')
|
||||
|
||||
handleOscLink(
|
||||
'file://Server/Share/Repo/src/app.ts#L12C3',
|
||||
{ metaKey: false, ctrlKey: true },
|
||||
{
|
||||
...deps,
|
||||
worktreePath: '//Server/Share/Repo'
|
||||
}
|
||||
)
|
||||
await flushAsyncWork()
|
||||
await flushDoubleRaf()
|
||||
|
||||
expect(authorizeExternalPathMock).toHaveBeenCalledWith({
|
||||
targetPath: '//server/Share/Repo/src/app.ts'
|
||||
})
|
||||
expect(openFileMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
filePath: '//server/Share/Repo/src/app.ts',
|
||||
relativePath: 'src/app.ts'
|
||||
})
|
||||
)
|
||||
expect(setPendingEditorRevealMock).toHaveBeenNthCalledWith(1, null)
|
||||
expect(setPendingEditorRevealMock).toHaveBeenNthCalledWith(2, {
|
||||
filePath: '//server/Share/Repo/src/app.ts',
|
||||
line: 12,
|
||||
column: 3,
|
||||
matchLength: 0
|
||||
})
|
||||
})
|
||||
|
||||
it('opens relative OSC file links against the terminal cwd', async () => {
|
||||
setPlatform('Macintosh')
|
||||
|
||||
|
||||
@@ -20,6 +20,13 @@ describe('terminal path helpers', () => {
|
||||
expect(
|
||||
toWorktreeRelativePath('//server/share/repo/src/file.ts', '\\\\server\\share\\repo')
|
||||
).toBe('src/file.ts')
|
||||
|
||||
expect(isPathInsideWorktree('//server/share/repo/src/file.ts', '//Server/Share/Repo')).toBe(
|
||||
true
|
||||
)
|
||||
expect(toWorktreeRelativePath('//server/share/repo/src/file.ts', '//Server/Share/Repo')).toBe(
|
||||
'src/file.ts'
|
||||
)
|
||||
})
|
||||
|
||||
describe('extractTerminalFileLinks bare-filename tokens', () => {
|
||||
|
||||
Reference in New Issue
Block a user