[ruby-core:94734] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
From:
matz@...
Date:
2019-09-02 06:50:43 UTC
List:
ruby-core #94734
Issue #15244 has been updated by matz (Yukihiro Matsumoto).
Status changed from Open to Feedback
`.git` is not an extension but a filename. `.a.jpg` has `.jpg` extension. I wonder how we can parse `..jpg`. It's undefined behavior for me.
Any reasoning?
Matz.
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-81350
* 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>