view_component 3.0.0.rc4 → 3.0.0.rc5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of view_component might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/controllers/view_components_system_test_controller.rb +5 -3
- data/docs/CHANGELOG.md +14 -0
- data/lib/view_component/capture_compatibility.rb +2 -0
- data/lib/view_component/compiler.rb +1 -2
- data/lib/view_component/system_test_helpers.rb +1 -1
- data/lib/view_component/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3746041e156447e727a9974ad435795bd08333c13f6004ba5a03f629764d301d
|
4
|
+
data.tar.gz: 47e3d85474b5cb69fbc12abb48a59a85776f14475508ff55f40f672f393bd309
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc5edccc814c845eb63ce951e621365ec9ec3013363b32b0bc5f05db8a0fb15ea26688eae22f54fcc17bbc477c5e93350cd0b3fbf3af9bd1e27f1f3f9e53cbec
|
7
|
+
data.tar.gz: d87a2ee301acf5b4e67ec159bc3433ce2d46da343de5da26af975314b862b4befbfdd247a0046239b99bb322e26b4062625073424ba0fd7e54a1e973a2d56ebd
|
@@ -1,11 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class ViewComponentsSystemTestController < ActionController::Base # :nodoc:
|
4
|
-
TEMP_DIR = FileUtils.mkdir_p("./tmp/view_components/").first
|
5
|
-
|
6
4
|
before_action :validate_test_env
|
7
5
|
before_action :validate_file_path
|
8
6
|
|
7
|
+
def self.temp_dir
|
8
|
+
@_tmpdir ||= FileUtils.mkdir_p("./tmp/view_components/").first
|
9
|
+
end
|
10
|
+
|
9
11
|
def system_test_entrypoint
|
10
12
|
render file: @path
|
11
13
|
end
|
@@ -19,7 +21,7 @@ class ViewComponentsSystemTestController < ActionController::Base # :nodoc:
|
|
19
21
|
# Ensure that the file path is valid and doesn't target files outside
|
20
22
|
# the expected directory (e.g. via a path traversal or symlink attack)
|
21
23
|
def validate_file_path
|
22
|
-
base_path = ::File.realpath(
|
24
|
+
base_path = ::File.realpath(self.class.temp_dir)
|
23
25
|
@path = ::File.realpath(params.permit(:file)[:file], base_path)
|
24
26
|
unless @path.start_with?(base_path)
|
25
27
|
raise ArgumentError, "Invalid file path"
|
data/docs/CHANGELOG.md
CHANGED
@@ -10,6 +10,20 @@ nav_order: 5
|
|
10
10
|
|
11
11
|
## main
|
12
12
|
|
13
|
+
## v3.0.0.rc5
|
14
|
+
|
15
|
+
* Fix bug where `mkdir_p` failed due to incorrect permissions.
|
16
|
+
|
17
|
+
*Joel Hawksley*
|
18
|
+
|
19
|
+
* Check for inline `erb_template` calls when deciding whether or not to compile a component's superclass.
|
20
|
+
|
21
|
+
*Justin Kenyon*
|
22
|
+
|
23
|
+
* Protect against `SystemStackError` if `CaptureCompatibility` module is included more than once.
|
24
|
+
|
25
|
+
*Cameron Dutro*
|
26
|
+
|
13
27
|
## v3.0.0.rc4
|
14
28
|
|
15
29
|
Run into an issue with this release candidate? [Let us know](https://github.com/ViewComponent/view_component/issues/1629).
|
@@ -17,6 +17,8 @@ module ViewComponent
|
|
17
17
|
# the `capture` logic to the ViewComponent that created the block.
|
18
18
|
module CaptureCompatibility
|
19
19
|
def self.included(base)
|
20
|
+
return if base < InstanceMethods
|
21
|
+
|
20
22
|
base.class_eval do
|
21
23
|
alias_method :original_capture, :capture
|
22
24
|
end
|
@@ -285,8 +285,7 @@ module ViewComponent
|
|
285
285
|
end
|
286
286
|
|
287
287
|
def should_compile_superclass?
|
288
|
-
development? &&
|
289
|
-
templates.empty? &&
|
288
|
+
development? && templates.empty? && !has_inline_template? &&
|
290
289
|
!(
|
291
290
|
component_class.instance_methods(false).include?(:call) ||
|
292
291
|
component_class.private_instance_methods(false).include?(:call)
|
@@ -12,7 +12,7 @@ module ViewComponent
|
|
12
12
|
def with_rendered_component_path(fragment, layout: false, &block)
|
13
13
|
file = Tempfile.new(
|
14
14
|
["rendered_#{fragment.class.name}", ".html"],
|
15
|
-
ViewComponentsSystemTestController
|
15
|
+
ViewComponentsSystemTestController.temp_dir
|
16
16
|
)
|
17
17
|
begin
|
18
18
|
file.write(vc_test_controller.render_to_string(html: fragment.to_html.html_safe, layout: layout))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.rc5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ViewComponent Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|