1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Validate template extensions [#1187 state:resolved]

This commit is contained in:
Joshua Peek 2008-12-03 09:59:04 -06:00
parent 99f2cb4918
commit 2fc6c7dd05
2 changed files with 7 additions and 8 deletions

View file

@ -115,16 +115,14 @@ module ActionView #:nodoc:
# [base_path, name, format, extension]
def split(file)
if m = file.match(/^(.*\/)?([^\.]+)\.?(\w+)?\.?(\w+)?\.?(\w+)?$/)
if m[5] # Multipart formats
if valid_extension?(m[5]) # Multipart formats
[m[1], m[2], "#{m[3]}.#{m[4]}", m[5]]
elsif m[4] # Single format
elsif valid_extension?(m[4]) # Single format
[m[1], m[2], m[3], m[4]]
else
if valid_extension?(m[3]) # No format
[m[1], m[2], nil, m[3]]
else # No extension
[m[1], m[2], m[3], nil]
end
elsif valid_extension?(m[3]) # No format
[m[1], m[2], nil, m[3]]
else # No extension
[m[1], m[2], m[3], nil]
end
end
end

View file

@ -0,0 +1 @@
non-template file