mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Better handling of in file templates
`__END__` in the middle of lines should not be recognized as the end of the ruby script. Ruby only accepts the line just contain `__END__`. Beginning/tailing whitespaces are not allowed. Signed-off-by: Simon Rozet <simon@rozet.name>
This commit is contained in:
parent
b88c0f579a
commit
64d852ea6f
2 changed files with 3 additions and 1 deletions
|
@ -637,7 +637,7 @@ module Sinatra
|
|||
file ||= caller_files.first
|
||||
|
||||
begin
|
||||
data = ::IO.read(file).split('__END__')[1]
|
||||
data = ::IO.read(file).split(/^__END__$/)[1]
|
||||
rescue
|
||||
data = nil
|
||||
end
|
||||
|
|
|
@ -87,6 +87,8 @@ class TemplatesTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
# __END__ : this is not the real end of the script.
|
||||
|
||||
__END__
|
||||
|
||||
@@ foo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue