actionview 4.1.14 → 4.1.14.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionview might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/action_view/gem_version.rb +1 -1
- data/lib/action_view/lookup_context.rb +4 -0
- data/lib/action_view/path_set.rb +19 -7
- data/lib/action_view/renderer/abstract_renderer.rb +1 -1
- data/lib/action_view/renderer/template_renderer.rb +1 -1
- data/lib/action_view/template/resolver.rb +21 -4
- data/lib/action_view/testing/resolvers.rb +2 -2
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c1584ed23b0d7430632b83ed06cc2fc38212e4e
|
4
|
+
data.tar.gz: 47f940efff8a3065e971f34191e7bdb05a86c8b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5658503cad9e3b25ca5542cd39755ce2f7c63e0214f1eb8a9af11a7130cc42211eb167f9226915c17fcd8863d8944697b3035bbb27d6b35d144de9a14ce0d775
|
7
|
+
data.tar.gz: 4350674e46a91e253a2eec43a20a355ac8412eee11235fd02dd61370721250efbe2de06d9ab3ead65be75007fd213d3f8e83f9759f63e6f43ca1fce5cd5c06bc
|
@@ -125,6 +125,10 @@ module ActionView
|
|
125
125
|
end
|
126
126
|
alias :find_template :find
|
127
127
|
|
128
|
+
def find_file(name, prefixes = [], partial = false, keys = [], options = {})
|
129
|
+
@view_paths.find_file(*args_for_lookup(name, prefixes, partial, keys, options))
|
130
|
+
end
|
131
|
+
|
128
132
|
def find_all(name, prefixes = [], partial = false, keys = [], options = {})
|
129
133
|
@view_paths.find_all(*args_for_lookup(name, prefixes, partial, keys, options))
|
130
134
|
end
|
data/lib/action_view/path_set.rb
CHANGED
@@ -46,23 +46,35 @@ module ActionView #:nodoc:
|
|
46
46
|
find_all(*args).first || raise(MissingTemplate.new(self, *args))
|
47
47
|
end
|
48
48
|
|
49
|
+
def find_file(path, prefixes = [], *args)
|
50
|
+
_find_all(path, prefixes, args, true).first || raise(MissingTemplate.new(self, path, prefixes, *args))
|
51
|
+
end
|
52
|
+
|
49
53
|
def find_all(path, prefixes = [], *args)
|
54
|
+
_find_all path, prefixes, args, false
|
55
|
+
end
|
56
|
+
|
57
|
+
def exists?(path, prefixes, *args)
|
58
|
+
find_all(path, prefixes, *args).any?
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def _find_all(path, prefixes, args, outside_app)
|
50
64
|
prefixes = [prefixes] if String === prefixes
|
51
65
|
prefixes.each do |prefix|
|
52
66
|
paths.each do |resolver|
|
53
|
-
|
67
|
+
if outside_app
|
68
|
+
templates = resolver.find_all_anywhere(path, prefix, *args)
|
69
|
+
else
|
70
|
+
templates = resolver.find_all(path, prefix, *args)
|
71
|
+
end
|
54
72
|
return templates unless templates.empty?
|
55
73
|
end
|
56
74
|
end
|
57
75
|
[]
|
58
76
|
end
|
59
77
|
|
60
|
-
def exists?(path, prefixes, *args)
|
61
|
-
find_all(path, prefixes, *args).any?
|
62
|
-
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
78
|
def typecast(paths)
|
67
79
|
paths.map do |path|
|
68
80
|
case path
|
@@ -15,7 +15,7 @@ module ActionView
|
|
15
15
|
# that new object is called in turn. This abstracts the setup and rendering
|
16
16
|
# into a separate classes for partials and templates.
|
17
17
|
class AbstractRenderer #:nodoc:
|
18
|
-
delegate :find_template, :template_exists?, :with_fallbacks, :with_layout_format, :formats, :to => :@lookup_context
|
18
|
+
delegate :find_template, :find_file, :template_exists?, :with_fallbacks, :with_layout_format, :formats, :to => :@lookup_context
|
19
19
|
|
20
20
|
def initialize(lookup_context)
|
21
21
|
@lookup_context = lookup_context
|
@@ -30,7 +30,7 @@ module ActionView
|
|
30
30
|
elsif options.key?(:html)
|
31
31
|
Template::HTML.new(options[:html], formats.first)
|
32
32
|
elsif options.key?(:file)
|
33
|
-
with_fallbacks {
|
33
|
+
with_fallbacks { find_file(options[:file], nil, false, keys, @details) }
|
34
34
|
elsif options.key?(:inline)
|
35
35
|
handler = Template.handler_for_extension(options[:type] || "erb")
|
36
36
|
Template.new(options[:inline], "inline template", handler, :locals => keys)
|
@@ -112,7 +112,13 @@ module ActionView
|
|
112
112
|
# Normalizes the arguments and passes it on to find_templates.
|
113
113
|
def find_all(name, prefix=nil, partial=false, details={}, key=nil, locals=[])
|
114
114
|
cached(key, [name, prefix, partial], details, locals) do
|
115
|
-
find_templates(name, prefix, partial, details)
|
115
|
+
find_templates(name, prefix, partial, details, false)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def find_all_anywhere(name, prefix, partial=false, details={}, key=nil, locals=[])
|
120
|
+
cached(key, [name, prefix, partial], details, locals) do
|
121
|
+
find_templates(name, prefix, partial, details, true)
|
116
122
|
end
|
117
123
|
end
|
118
124
|
|
@@ -173,15 +179,16 @@ module ActionView
|
|
173
179
|
|
174
180
|
private
|
175
181
|
|
176
|
-
def find_templates(name, prefix, partial, details)
|
182
|
+
def find_templates(name, prefix, partial, details, outside_app_allowed = false)
|
177
183
|
path = Path.build(name, prefix, partial)
|
178
|
-
query(path, details, details[:formats])
|
184
|
+
query(path, details, details[:formats], outside_app_allowed)
|
179
185
|
end
|
180
186
|
|
181
|
-
def query(path, details, formats)
|
187
|
+
def query(path, details, formats, outside_app_allowed)
|
182
188
|
query = build_query(path, details)
|
183
189
|
|
184
190
|
template_paths = find_template_paths query
|
191
|
+
template_paths = reject_files_external_to_app(template_paths) unless outside_app_allowed
|
185
192
|
|
186
193
|
template_paths.map { |template|
|
187
194
|
handler, format, variant = extract_handler_and_format_and_variant(template, formats)
|
@@ -196,6 +203,10 @@ module ActionView
|
|
196
203
|
}
|
197
204
|
end
|
198
205
|
|
206
|
+
def reject_files_external_to_app(files)
|
207
|
+
files.reject { |filename| !inside_path?(@path, filename) }
|
208
|
+
end
|
209
|
+
|
199
210
|
if RUBY_VERSION >= '2.2.0'
|
200
211
|
def find_template_paths(query)
|
201
212
|
Dir[query].reject { |filename|
|
@@ -216,6 +227,12 @@ module ActionView
|
|
216
227
|
end
|
217
228
|
end
|
218
229
|
|
230
|
+
def inside_path?(path, filename)
|
231
|
+
filename = File.expand_path(filename)
|
232
|
+
path = File.join(path, '')
|
233
|
+
filename.start_with?(path)
|
234
|
+
end
|
235
|
+
|
219
236
|
# Helper for building query glob string based on resolver's pattern.
|
220
237
|
def build_query(path, details)
|
221
238
|
query = @pattern.dup
|
@@ -19,7 +19,7 @@ module ActionView #:nodoc:
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def query(path, exts, formats)
|
22
|
+
def query(path, exts, formats, _)
|
23
23
|
query = ""
|
24
24
|
EXTENSIONS.each_key do |ext|
|
25
25
|
query << '(' << exts[ext].map {|e| e && Regexp.escape(".#{e}") }.join('|') << '|)'
|
@@ -44,7 +44,7 @@ module ActionView #:nodoc:
|
|
44
44
|
end
|
45
45
|
|
46
46
|
class NullResolver < PathResolver
|
47
|
-
def query(path, exts, formats)
|
47
|
+
def query(path, exts, formats, _)
|
48
48
|
handler, format, variant = extract_handler_and_format_and_variant(path, formats)
|
49
49
|
[ActionView::Template.new("Template generated by Null Resolver", path, handler, :virtual_path => path, :format => format, :variant => variant)]
|
50
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.14
|
4
|
+
version: 4.1.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.1.14
|
19
|
+
version: 4.1.14.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.1.14
|
26
|
+
version: 4.1.14.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 4.1.14
|
61
|
+
version: 4.1.14.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.1.14
|
68
|
+
version: 4.1.14.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activemodel
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 4.1.14
|
75
|
+
version: 4.1.14.1
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 4.1.14
|
82
|
+
version: 4.1.14.1
|
83
83
|
description: Simple, battle-tested conventions and helpers for building web pages.
|
84
84
|
email: david@loudthinking.com
|
85
85
|
executables: []
|
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
213
|
requirements:
|
214
214
|
- none
|
215
215
|
rubyforge_project:
|
216
|
-
rubygems_version: 2.
|
216
|
+
rubygems_version: 2.5.1
|
217
217
|
signing_key:
|
218
218
|
specification_version: 4
|
219
219
|
summary: Rendering framework putting the V in MVC (part of Rails).
|