Project

General

Profile

Bug #15267

File.basename + File.extname does not restore the original name

Added by nobu (Nobuyoshi Nakada) 6 months ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:89615]

Description

Related to #15224, I found the case File.basename(name, '.*')+File.extname(name) == File.basename(name) is not true.

name = 'file.'
File.basename(name, '.*') #=> "name"
File.extname(name) #=> ""

Both do not contain the last dot.

basename(1) seems to result in the base name with the dot, when stripping a wildcard suffix.

$ basename name. '.*'
name.

Also available in: Atom PDF