[ruby-core:94741] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
From:
nobu@...
Date:
2019-09-02 09:42:50 UTC
List:
ruby-core #94741
Issue #15244 has been updated by nobu (Nobuyoshi Nakada).
znz (Kazuhiro NISHIYAMA) wrote:
> ```
> % php --version
> PHP 7.1.23 (cli) (built: Feb 22 2019 22:19:32) ( NTS )
> Copyright (c) 1997-2018 The PHP Group
> Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
> % php -r 'var_export(pathinfo("..jpg", PATHINFO_EXTENSION));'
> 'jpg'
> ```
Seems not for us:
```php
var_export(pathinfo(".profile", PATHINFO_EXTENSION)); //=> 'profile'
```
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-81358
* 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>