diff --git a/Handle-non-string-partial-body-in-ActionView-Collect.patch b/Handle-non-string-partial-body-in-ActionView-Collect.patch new file mode 100644 index 0000000..df61e62 --- /dev/null +++ b/Handle-non-string-partial-body-in-ActionView-Collect.patch @@ -0,0 +1,40 @@ +From 770060d93a897cb5fb5108bb828b927fe6bb5353 Mon Sep 17 00:00:00 2001 +From: Jean Boussier +Date: Mon, 14 Aug 2023 11:20:43 +0200 +Subject: [PATCH] Handle non-string partial body in + ActionView::CollectionCaching + +Followup: https://github.com/rails/rails/pull/48645 + +Some template engines such as `jbuilder` use these Action View primitives +with types other than strings, which breaks a bunch of assumptions. + +I wish I could add a test for this, but this is deep in private methods +I don't see a way to cover this. +--- + .../renderer/partial_renderer/collection_caching.rb | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb +index d65d4c0cafaba..6ee720aa4896b 100644 +--- a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb ++++ b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb +@@ -96,9 +96,16 @@ def fetch_or_cache_partial(cached_partials, template, order_by:) + build_rendered_template(content, template) + else + rendered_partial = yield +- if fragment = rendered_partial.body&.to_str +- entries_to_write[cache_key] = fragment ++ body = rendered_partial.body ++ ++ # We want to cache buffers as raw strings. This both improve performance and ++ # avoid creating forward compatibility issues with the internal representation ++ # of these two types. ++ if body.is_a?(ActionView::OutputBuffer) || body.is_a?(ActiveSupport::SafeBuffer) ++ body = body.to_str + end ++ ++ entries_to_write[cache_key] = body + rendered_partial + end + end diff --git a/actionview-7.0.4.gem b/actionview-7.0.4.gem deleted file mode 100644 index 8021400..0000000 Binary files a/actionview-7.0.4.gem and /dev/null differ diff --git a/actionview-7.0.4-tests.txz b/actionview-7.0.7-tests.txz similarity index 96% rename from actionview-7.0.4-tests.txz rename to actionview-7.0.7-tests.txz index e4c27e3..6383ba6 100644 Binary files a/actionview-7.0.4-tests.txz and b/actionview-7.0.7-tests.txz differ diff --git a/actionview-7.0.7.gem b/actionview-7.0.7.gem new file mode 100644 index 0000000..709c466 Binary files /dev/null and b/actionview-7.0.7.gem differ diff --git a/rails-7.0.4-tools.txz b/rails-7.0.7-tools.txz similarity index 97% rename from rails-7.0.4-tools.txz rename to rails-7.0.7-tools.txz index a34575f..842cffc 100644 Binary files a/rails-7.0.4-tools.txz and b/rails-7.0.7-tools.txz differ diff --git a/rubygem-actionview.spec b/rubygem-actionview.spec index 915e949..9238a53 100644 --- a/rubygem-actionview.spec +++ b/rubygem-actionview.spec @@ -2,7 +2,7 @@ %bcond_with bootstrap Name: rubygem-%{gem_name} -Version: 7.0.4 +Version: 7.0.7 Release: 1 Summary: Rendering framework putting the V in MVC (part of Rails) License: MIT @@ -11,18 +11,20 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem # The gem doesn't ship with the test suite. # You may check it out like so # git clone http://github.com/rails/rails.git -# cd rails/actionview && git archive -v -o actionview-7.0.4-tests.txz v7.0.4 test/ +# cd rails/actionview && git archive -v -o actionview-7.0.7-tests.txz v7.0.7 test/ Source1: %{gem_name}-%{version}-tests.txz # The tools are needed for the test suite, are however unpackaged in gem file. # You may get them like so # git clone http://github.com/rails/rails.git --no-checkout -# cd rails && git archive -v -o rails-7.0.4-tools.txz v7.0.4 tools/ +# cd rails && git archive -v -o rails-7.0.7-tools.txz v7.0.7 tools/ Source2: rails-%{version}-tools.txz # Fixes for Minitest 5.16+ # https://github.com/rails/rails/pull/45380 Patch0: rubygem-actionview-7.0.2.3-Remove-the-multi-call-form-of-assert_called_with.patch # https://github.com/rails/rails/pull/45370 Patch1: rubygem-actionview-7.0.2.3-Fix-tests-for-minitest-5.16.patch +# https://github.com/rails/rails/commit/770060d93a897cb5fb5108bb828b927fe6bb5353 +Patch2: Handle-non-string-partial-body-in-ActionView-Collect.patch BuildRequires: ruby(release) BuildRequires: rubygems-devel rubygem(did_you_mean) @@ -49,6 +51,7 @@ Documentation for %{name}. %prep %setup -q -n %{gem_name}-%{version} -b1 -b2 +%patch2 -p2 pushd %{_builddir} %patch0 -p2 @@ -96,6 +99,9 @@ popd %doc %{gem_instdir}/CHANGELOG.md %changelog +* Thu Aug 17 2023 wulei - 7.0.7-1 +- Upgrade to version 7.0.7 + * Thu Jan 19 2023 yanxiaobing - 7.0.4-1 - Upgrade to version 7.0.4