Repository navigation
fix(directory): ignore trailing separators on home and project dirs - #134
Merged
Merged
Conversation
A HOME of /home/al/ stopped collapsing paths under it to ~, and a project dir of /srv/app/ stopped showing subfolders relative to it. Both callers matched the base path and then sliced by its length, which assumes the base never ends in a separator. pathBelow replaces isPathWithin and returns the remainder below the base itself, so callers no longer slice by length. A root base such as / still only matches itself.
Member
|
🎉 This PR is included in version 1.32.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #131.
With
HOME=/home/al/, paths under it were no longer collapsed to~. A project dir with a trailing separator (/srv/app/) had the same problem, so its subfolders showed as full paths instead of relative ones.Both callers matched the base path and then sliced by its length, which assumes the base has no trailing separator.
pathBelowreplacesisPathWithin. It trims the base's trailing separators and returns the remainder itself, so callers no longer slice by length. A root base such as/keeps its separator and only matches itself, soHOME=/still leaves paths unchanged.Tests cover both the helper and the directory segment. The two new segment tests fail on
main.