[ruby-core:95064] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
From:
ug.tiser@...
Date:
2019-09-24 19:08:20 UTC
List:
ruby-core #95064
Issue #15244 has been updated by TiSer (Sergey TiSer).
Example from .NET:
```
class Program
{
static void Main(string[] args)
{
string ext = Path.GetExtension("..jpg");
Console.WriteLine(ext);
Console.ReadLine();
}
}
=> '.jpg'
```
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-81697
* Author: TiSer (Sergey TiSer)
* Status: Feedback
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.7.0dev
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
### Example 1:
Current behaviour:
```
File.extname('..jpg')
=> ""
```
Expected behaviour:
```
File.extname('..jpg')
=> ".jpg"
```
### Example 2:
Current behaviour:
```
File.extname('....jpg')
=> ""
```
Expected behaviour:
```
=> ".jpg"
```
---Files--------------------------------
dot-names.diff (891 Bytes)
multiple-leading-dot-basename-extname-15244.patch (1.94 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>