Fix error with filenames ending with a dot (#3349)

The second negative argument to split instructs it to
preserve null fields in the returned array
This commit is contained in:
Paul Chaignon
2016-11-29 16:42:50 +01:00
committed by Brandon Black
parent 829eea0139
commit 1d2ec4dbc3
2 changed files with 2 additions and 1 deletions

View File

@@ -63,7 +63,7 @@ module Linguist
#
# Returns an Array
def extensions
_, *segments = name.downcase.split(".")
_, *segments = name.downcase.split(".", -1)
segments.map.with_index do |segment, index|
"." + segments[index..-1].join(".")