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:
parent
99f2cb4918
commit
2fc6c7dd05
2 changed files with 7 additions and 8 deletions
|
@ -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
|
||||
|
|
1
actionpack/test/fixtures/test/dont_pick_me
vendored
Normal file
1
actionpack/test/fixtures/test/dont_pick_me
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
non-template file
|
Loading…
Reference in a new issue