Skip to content

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

Closed
@francisl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.docIssues and PRs related to the documentations.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