Skip to content

path.win32.isAbsolute considers relative paths absolute #56766

Description

@reverofevil

Version

22.11.0

Platform

Linux pc 6.8.0-48-generic #48-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 14:04:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

require('path').win32.isAbsolute('\\foo') === true

How often does it reproduce? Is there a required condition?

Yes. No.

What is the expected behavior? Why is that the expected behavior?

Here's a behavior of cd on Windows:

C:\Users\user> cd \Windows
C:\Windows>

\Windows is relative to drive name.

Expected output for isAbsolute() is false.

What do you see instead?

isAbsolute() is true.

Additional information

(Edited to prevent the issue from deletion by dumb AI.)

Activity

  1. added
    pathIssues and PRs related to the path subsystem.
    on Jan 26, 2025
  2. ChaseKnowlden commented on Feb 1, 2025

    @ChaseKnowlden

    That is normal to be true.

  3. ljharb commented on Feb 1, 2025

    @ljharb
    SponsorMember

    "relative to drive name" is still an absolute path, imo - it's just a concept that doesn't exist on any other OS.

  4. reverofevil commented on Feb 1, 2025

    @reverofevil
    Author

    If it's an absolute path, can you move source code to another drive, and get it work the same way?

    I hope we're not here to blame windows for having weird features other OSes don't, but to get Node.js path library right, and applications breaking due to relative paths considered absolute is not right.

  5. ljharb commented on Feb 1, 2025

    @ljharb
    SponsorMember

    That’s a fair point - i meant more that windows has three concepts (relative, absolute, and drive-relative) and every other OS has two (relative and absolute), and node doesn’t seem to have any concept of drive-relative yet, so I’m not sure what a safe fix would be.

  6. gurgunday commented on Feb 15, 2025

    @gurgunday
    Member

    Should I try to implement a fix?

    To get more info: Is this "drive-relative" concept "official"? Does Windows really consider it relative or is it just an argument you're making?

  7. reverofevil commented on Feb 15, 2025

    @reverofevil
    Author

    From here

    If all three components are present, the path is absolute. If no volume or drive letter is specified and the directory name begins with the directory separator character, the path is relative from the root of the current drive.

  8. ljharb commented on Feb 15, 2025

    @ljharb
    SponsorMember

    @gurgunday unfortunately i'm not clear on what would be the best path. it seems like it would have been better for node to have 3 concepts to begin with since windows has 3, but node has always only had 2, so this ambiguity persists.

  9. github-actions commented on Apr 22, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 210 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  10. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Apr 22, 2026
  11. reverofevil commented on Apr 22, 2026

    @reverofevil
    Author

    comment

  12. removed
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Apr 23, 2026
  13. github-actions commented on Jul 23, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 90 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  14. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jul 23, 2026
  15. reverofevil commented on Jul 25, 2026

    @reverofevil
    Author

    comment

  16. removed
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pathIssues and PRs related to the path subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions