[ruby-core:93934] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
From:
rushsteve1@...1.us
Date:
2019-07-26 17:16:13 UTC
List:
ruby-core #93934
Issue #15244 has been updated by rushsteve1 (Steven vanZyl).
File dot-names.diff added
The issue seemed to be in how .dotfiles were handled, where all leading periods were trimmed when only the first should have been.
I've created a patch that seems to fix the issue and added a spect test for it. It's only a 2 line change.
This is my first patch submission so any and all feedback would be greatly appreciated.
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-80090
* Author: TiSer (Sergey TiSer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0p0
* 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 (885 Bytes)
--
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>