lib/carrierwave/sanitized_file.rb in carrierwave-0.4.2 vs lib/carrierwave/sanitized_file.rb in carrierwave-0.4.3
- old
+ new
@@ -252,21 +252,22 @@
name = "_#{name}" if name =~ /\A\.+\z/
name = "unnamed" if name.size == 0
return name.downcase
end
- def split_extension(fn)
+ def split_extension(filename)
# regular expressions to try for identifying extensions
- ext_regexps = [
- /\A(.+)\.([^\.]{1,3}\.[^\.]{1,4})\z/, # matches "something.tar.gz"
+ extension_matchers = [
+ /\A(.+)\.(tar\.gz)\z/, # matches "something.tar.gz"
/\A(.+)\.([^\.]+)\z/ # matches "something.jpg"
]
- ext_regexps.each do |regexp|
- if fn =~ regexp
+
+ extension_matchers.each do |regexp|
+ if filename =~ regexp
return $1, $2
end
end
- return fn, "" # In case we weren't able to split the extension
+ return filename, "" # In case we weren't able to split the extension
end
end # SanitizedFile
end # CarrierWave