Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

PathUtils NormalizePath method #2103

Open
makzimus opened this issue Jul 18, 2020 · 2 comments
Open

PathUtils NormalizePath method #2103

makzimus opened this issue Jul 18, 2020 · 2 comments
Labels
question A question about the LS

Comments

@makzimus
Copy link

I hesitate to file this as a bug because it may not be but the code in NormalizePath is doing this:

                if (parts[i] == "..") {
                    var found = false;
                    for (var j = i - 1; j >= 0; --j) {
                        if (!string.IsNullOrEmpty(parts[j])) {
                            parts[i] = null;
                            parts[j] = null;
                            found = true;
                            break;
                        }
                    }
                    if (!found && !string.IsNullOrEmpty(root)) {
                        parts[i] = null;
                    }
                    continue;
                }

This is transforming the user search paths that are relative more than one level up.
Ex: "../../libs" will transform to "libs".

Is this intended and relative paths just aren't supported? Or is this just old code that needs updating?

@makzimus makzimus added the question A question about the LS label Jul 18, 2020
@makzimus makzimus changed the title PathUtils NoramlizePath method PathUtils NormalizePath method Jul 18, 2020
@makzimus
Copy link
Author

The subsequent line will also break relative path parts.

parts[i] = parts[i].TrimEnd(' ', '.');

@tpajenkamp-dspace
Copy link

Maybe related to this #1975 ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question A question about the LS
Projects
None yet
Development

No branches or pull requests

2 participants