Skip to content

fix: windows abs path support#3720

Merged
fiftin merged 4 commits into2-17-stablefrom
fix/windows_path
Mar 24, 2026
Merged

fix: windows abs path support#3720
fiftin merged 4 commits into2-17-stablefrom
fix/windows_path

Conversation

@fiftin
Copy link
Copy Markdown
Collaborator

@fiftin fiftin commented Mar 24, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Windows absolute-path support for “local” repositories across the UI and backend, aligning repository type detection with Windows drive/UNC path formats and normalizing MSYS/Git Bash-style paths for Windows runtime.

Changes:

  • Add shared frontend URL/path classifier to treat Windows drive/UNC paths as local repositories.
  • Update repository UI/form logic to hide branch for local repos and avoid prefixing / for Windows paths.
  • Add backend helpers to detect Windows local paths and normalize MSYS-style paths before filesystem access, plus corresponding Go tests.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
web/src/views/project/Repositories.vue Uses a shared helper to decide when to display the git branch (avoids treating Windows local paths as remote).
web/src/lib/repositoryUrl.js Introduces shared repository URL/path classification and isLocalRepositoryPath.
web/src/components/RepositoryForm.vue Reuses shared classifier for validation/type detection; avoids forcing / prefix for Windows drive/UNC paths.
util/local_path.go Adds Windows path normalization for MSYS/Git Bash-style paths and Windows local-path detection.
util/local_path_test.go Adds unit tests for Windows local-path detection and normalization behavior.
services/tasks/LocalJob.go Uses normalized local repo path when checking existence (os.Stat).
db/Repository.go Treats Windows drive/UNC paths as RepositoryLocal; normalizes local paths in GetGitURL.
db/Repository_test.go Adds tests verifying Windows paths are classified as RepositoryLocal.

Comment on lines +8 to +12
export function getRepositoryUrlType(url) {
if (url == null || url === '') {
return null;
}

Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

web/src/lib/repositoryUrl.js adds new URL/path classification logic (including Windows drive and UNC handling), but there are no unit tests covering the expected cases. Since the repo already has Mocha unit tests for web/src/lib/*, please add tests for getRepositoryUrlType/isLocalRepositoryPath (e.g., /abs/path, D:\repo, D:/repo, \\server\\share, git@host:repo, https://..., unknown schemes).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14c06e3326

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if p[0] == '\\' && p[1] == '\\' {
return len(p) > 2
}
return isDriveLetter(p[0]) && p[1] == ':'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require separator after drive letter in path detection

IsWindowsLocalRepositoryPath currently treats any string starting with <letter>: as a local repo path, so values like a://example/repo.git are misclassified as local instead of URL-like input. This is a regression from the previous behavior and causes invalid URLs to pass type checks (and skip branch requirements) until runtime, where local-path handling fails on os.Stat. Restrict the drive-letter rule to actual filesystem forms (e.g. ^[A-Za-z]:(\\|/|$)) to avoid classifying URI schemes as local paths.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot fix it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex fix it

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

  • Tightened IsWindowsLocalRepositoryPath so drive-letter paths now require X: followed by either end-of-string, \, or /, and reject non-filesystem forms like D:repo. This prevents broad misclassification from just <letter>:. util/local_path.goL35-L57
  • Added a guard to reject URL-like a://... inputs while still accepting valid drive/UNC local path formats. util/local_path.goL53-L56
  • Expanded unit coverage with regression tests for D:repo and a://example/repo.git to lock in the corrected behavior. util/local_path_test.goL14-L25

Testing

  • go test ./util

View task →

@fiftin fiftin merged commit 00257da into 2-17-stable Mar 24, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants