Skip to content

fix(path): Trim ending slash when initializing paths#6501

Merged
niheaven merged 5 commits intodevelopfrom
fix-path
Oct 21, 2025
Merged

fix(path): Trim ending slash when initializing paths#6501
niheaven merged 5 commits intodevelopfrom
fix-path

Conversation

@niheaven
Copy link
Copy Markdown
Member

@niheaven niheaven commented Sep 29, 2025

Description

Motivation and Context

How Has This Been Tested?

Checklist:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

Summary by CodeRabbit

  • Bug Fixes

    • Absolute path outputs no longer include trailing slashes or backslashes for consistent formatting.
  • Improvements

    • Path resolution now trims unnecessary trailing delimiters (except for root paths) to improve interoperability with other tools.
  • Documentation

    • Changelog formatting standardized for clearer, more consistent release notes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Sep 29, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Get-AbsolutePath in lib/core.ps1 now trims trailing slashes and backslashes from the resolved absolute path before returning; control flow and error handling remain unchanged. CHANGELOG.md contains only non-functional formatting/listing adjustments.

Changes

Cohort / File(s) Change Summary
Path normalization in core
lib/core.ps1
Get-AbsolutePath now trims trailing backslashes and slashes from the result of GetUnresolvedProviderPathFromPSPath($Path) (applies TrimEnd('\\','/')) before returning the path.
Changelog formatting
CHANGELOG.md
Non-functional formatting edits: adjusted headings and list markers under the Unreleased section; no code logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant Core as Get-AbsolutePath
  participant PSProv as PowerShell Provider

  Caller->>Core: Get-AbsolutePath(Path)
  Core->>PSProv: GetUnresolvedProviderPathFromPSPath(Path)
  PSProv-->>Core: ResolvedPath (may include trailing '\' or '/')
  Note right of Core #d3f4ff: New step — TrimEnd('\\','/')\n(remove trailing slashes/backslashes)
  Core-->>Caller: NormalizedAbsolutePath
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I hop through slashes, nose so keen,
Nibbling trailing chars unseen.
With a TrimEnd nibble, paths set right,
No extra slashes in my sight.
A tidy route — rabbit-approved delight. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix(path): Trim ending slash when initializing paths" directly and clearly describes the primary change in the changeset. The title uses proper conventional commit format with a "fix" type, identifies the scope as "path", and accurately summarizes the core modification: trimming trailing slashes from paths. This aligns precisely with the function-level change where Get-AbsolutePath now removes trailing delimiters from non-root paths before returning them.
Linked Issues Check ✅ Passed The code changes successfully address the objectives from all three linked issues. The modification to Get-AbsolutePath to trim trailing slashes from non-root paths directly resolves the root cause identified in #6485 (preventing doubled separators in concatenated paths), #6194 (eliminating path-related Remove-Item failures), and #6277 (preventing false overwrite warnings caused by trailing backslashes). By normalizing paths at initialization time for core directories ($scoopdir, $globaldir, $cachedir), the solution prevents the path comparison failures that trigger unnecessary warnings and errors during shim handling and app name detection.
Out of Scope Changes Check ✅ Passed All changes in the pull request are within scope and directly related to the linked issues. The primary functional change modifies Get-AbsolutePath to trim trailing slashes, which is the core fix for preventing path normalization issues. The CHANGELOG.md modifications are purely documentation-related formatting adjustments and entries documenting the bug fix, which are expected and appropriate for this type of change. No new public APIs were added, and no unrelated modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-path

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7bcde06 and 9e63244.

📒 Files selected for processing (1)
  • lib/core.ps1 (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/core.ps1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca0506c and 90ed663.

📒 Files selected for processing (1)
  • lib/core.ps1 (1 hunks)

Comment thread lib/core.ps1 Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment thread lib/core.ps1 Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 222b253 and 7bcde06.

📒 Files selected for processing (1)
  • lib/core.ps1 (1 hunks)

Comment thread lib/core.ps1
@niheaven niheaven merged commit 52a035b into develop Oct 21, 2025
3 checks passed
@niheaven niheaven deleted the fix-path branch October 21, 2025 03:27
Deide pushed a commit to Deide/scoop that referenced this pull request Feb 14, 2026
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.

1 participant