Skip to content

Wrong behavior of File.extname when the filename starts or ends with a period #5077

@masahino

Description

@masahino

Behavior of File.extname is incompatible with CRuby.

In CRuby

$ irb
irb(main):001:0> File.extname('.a.rb')
=> ".rb"
irb(main):002:0> File.extname('foo.')
=> "."

In mruby

$ mirb
mirb - Embeddable Interactive Ruby Shell

> File.extname('.a.rb')
 => ""
> File.extname('foo.')
 => ".foo"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions