python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

PathUtils NormalizePath method

Open makzimus opened this issue 5 years ago • 2 comments

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 avatar Jul 18 '20 00:07 makzimus

The subsequent line will also break relative path parts.

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

makzimus avatar Jul 18 '20 00:07 makzimus

Maybe related to this #1975 ?

tpajenkamp-dspace avatar Jul 20 '20 13:07 tpajenkamp-dspace