Skip to content

UNC paths are not handled appropriately by path.relative #10528

@amanda-mitchell

Description

@amanda-mitchell
  • Version: 6.3.1
  • Platform: 64 bit Windows 10
  • Subsystem: path.js

When calling path.relative, if the to parameter refers to a UNC (network) path, the result is incorrect.

Steps to Reproduce

Run the following program:

var path = require('path');

console.log(path.relative('c:\\some\\directory', '\\\\localhost\\c$\\another\\directory'));

Expected Result

The console output should be \\localhost\c$\another\directory because no relative path exists between the two paths.

Actual Result

The console output is localhost\c$\another\directory: the leading double backslash is omitted.

Extra Notes

The output is correct for two UNC paths to the same host. The output is incorrect for two UNC paths to different hosts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pathIssues and PRs related to the path subsystem.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions