[Bps-public-commit] rt-extension-formtools branch uniq-hidden-inputs created. 1.05-1-g4b4d593
BPS Git Server
git at git.bestpractical.com
Wed Feb 21 22:28:45 UTC 2024
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-formtools".
The branch, uniq-hidden-inputs has been created
at 4b4d5937646bf37858b63d9e2ea3c98017df332f (commit)
- Log -----------------------------------------------------------------
commit 4b4d5937646bf37858b63d9e2ea3c98017df332f
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Feb 21 17:23:52 2024 -0500
Remove duplicate values of hidden inputs
After "Back" and "Next" clicks, hidden inputs might be duplicated, like
the Content's assistant ContentType input. RT doesn't support duplicate
ContentType and it could cause double-encoded HTML content and wrong
Content-Type header of attachments.
diff --git a/html/FormTools/Form b/html/FormTools/Form
index f5ca591..989d85d 100644
--- a/html/FormTools/Form
+++ b/html/FormTools/Form
@@ -127,9 +127,10 @@ $next_for_validation ||= $m->caller(1)->path;
<%$content|n%>
% if ($enable_persisting) {
+% require List::MoreUtils;
% foreach my $key (keys %request_args) {
% next if (ref $request_args{$key} && ref $request_args{$key} ne 'ARRAY');
-% foreach my $val ( ref ($request_args{$key}) ? @{$request_args{$key}} : ($request_args{$key})) {
+% foreach my $val ( ref ($request_args{$key}) ? List::MoreUtils::uniq(@{$request_args{$key}}) : ($request_args{$key})) {
% next if $forbid_persisting->{$key};
% next if ($key eq 'user' or $key eq 'pass');
% next if $key eq 'Submit'; # No need to pass through "Next" button value
-----------------------------------------------------------------------
hooks/post-receive
--
rt-extension-formtools
More information about the Bps-public-commit
mailing list