Skip to content

path (extname, parse) cannot handle extension correctly for directory #6229

Description

@francisl
  • Version: v5.10.1
  • Platform: Darwin Kernel Version 15.3.0
  • Subsystem: path

On OS X and Linux its perfectly legal to use dot '.' in directory name.
Currently path.extname and path.parse handle . in directory name as a file extension.

e.g.

ext.extname('/Users/Bob.Dev')
> '.Dev'
ext.parse('/Users/John.Smith')
> { root: '/',
  dir: '/Users',
  base: 'Bob.Dev',
  ext: '.Dev',
  name: 'Bob' }

I understand that path don't do any validation. But this behavior is confusing an error prone.

Activity

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

    confirmed-bugIssues and PRs for confirmed bugs.docIssues and PRs related to Node.js documentation.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