diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index afd4dcee56..fd5505f05f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: push: branches: ['*'] pull_request: - branches: [main] + branches: [main, dev] jobs: ci: diff --git a/src/main/utils/pathValidation.ts b/src/main/utils/pathValidation.ts index 0bb7db0006..2ea799e062 100644 --- a/src/main/utils/pathValidation.ts +++ b/src/main/utils/pathValidation.ts @@ -1,7 +1,12 @@ import * as path from 'path' +// Regex to match Windows absolute paths (e.g., C:\Users or D:\) +const WINDOWS_ABSOLUTE_PATH_REGEX = /^[a-zA-Z]:[/\\]/ + export function isValidPath(inputPath: string): boolean { - if (!path.isAbsolute(inputPath)) { + // Check for absolute path (POSIX or Windows) + const isAbsolute = path.isAbsolute(inputPath) || WINDOWS_ABSOLUTE_PATH_REGEX.test(inputPath) + if (!isAbsolute) { return false } diff --git a/tests/unit/renderer/components/FileTreeComponent.test.tsx b/tests/unit/renderer/components/FileTreeComponent.test.tsx index d6e6a31d0d..b6ab0f23c4 100644 --- a/tests/unit/renderer/components/FileTreeComponent.test.tsx +++ b/tests/unit/renderer/components/FileTreeComponent.test.tsx @@ -1,7 +1,9 @@ /** * @vitest-environment jsdom */ -import React, { act } from 'react' +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import * as React from 'react' +import { act } from 'react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { createRoot, type Root } from 'react-dom/client' import { FileTree } from '../../../../src/renderer/src/components/FileTree'