[ruby-core:94734] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
| Newsgroups | gmane.comp.lang.ruby.core |
|---|---|
| Message-ID | <redmine.journal-81350.20190902065042.0602886db4c9d364@ruby-lang.org> |
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:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>