Bugzilla – Attachment 157843 Details for
Bug 25672
Administrators should be able to restrict client-side plugin upload to trusted sources
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25672: Fix double output_html_with_http_headers
Bug-25672-Fix-double-outputhtmlwithhttpheaders.patch (text/plain), 2.23 KB, created by
Victor Grousset/tuxayo
on 2023-10-25 16:25:55 UTC
(
hide
)
Description:
Bug 25672: Fix double output_html_with_http_headers
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2023-10-25 16:25:55 UTC
Size:
2.23 KB
patch
obsolete
>From 3c7f98c8202be41720c98793e665079c40c29786 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 24 Oct 2023 10:49:44 +0100 >Subject: [PATCH] Bug 25672: Fix double output_html_with_http_headers > >We weren't exiting after calling output_html_with_http_headers and so we >were ending up with a double template render (and also a subsequent >confusion in the cookie consent code). > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > plugins/plugins-upload.pl | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > >diff --git a/plugins/plugins-upload.pl b/plugins/plugins-upload.pl >index dff5a7536a..02fd2548c7 100755 >--- a/plugins/plugins-upload.pl >+++ b/plugins/plugins-upload.pl >@@ -35,24 +35,27 @@ my $plugins_enabled = C4::Context->config("enable_plugins"); > my $plugins_restricted = C4::Context->config("plugins_restricted"); > > my $input = CGI->new; >+my $uploadlocation = $input->param('uploadlocation'); > > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { >- template_name => $plugins_enabled ? "plugins/plugins-upload.tt" : "plugins/plugins-disabled.tt", >+ template_name => ( !$plugins_enabled || $plugins_restricted && !$uploadlocation ) >+ ? 'plugins/plugins-disabled.tt' >+ : 'plugins/plugins-upload.tt', > query => $input, > type => "intranet", > flagsrequired => { plugins => 'manage' }, > } > ); > >-my $uploadlocation = $input->param('uploadlocation'); >- >-# Early exists if uploads are not enabled direct upload attempted when uploads are restricted >+# Early exist if uploads are not enabled direct upload attempted when uploads are restricted > if (!$plugins_enabled) { > output_html_with_http_headers $input, $cookie, $template->output; >+ exit; > } elsif ( $plugins_restricted && !$uploadlocation ) { > $template->param( plugins_restricted => $plugins_restricted ); > output_html_with_http_headers $input, $cookie, $template->output; >+ exit; > } > > my $uploadfilename = $input->param('uploadfile'); >@@ -132,3 +135,5 @@ if ( ( $uploadfile || $uploadlocation ) && !%errors && !$template->param('ERRORS > } else { > output_html_with_http_headers $input, $cookie, $template->output; > } >+ >+exit; >-- >2.42.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25672
:
106651
|
106671
|
106673
|
106674
|
107172
|
107173
|
107174
|
153824
|
153825
|
153826
|
153827
|
153925
|
154423
|
154424
|
154425
|
154426
|
154427
|
154453
|
154455
|
154464
|
154465
|
154466
|
154467
|
154468
|
154474
|
154475
|
154476
|
154477
|
154478
|
156715
|
156716
|
156717
|
156718
|
156719
|
156720
|
156734
|
156735
|
156736
|
156737
|
156738
|
156739
|
156740
|
157730
|
157810
|
157811
|
157812
|
157813
|
157814
|
157815
|
157816
|
157817
|
157836
|
157837
|
157838
|
157839
|
157840
|
157841
|
157842
|
157843
|
157846
|
157847
|
157848
|
157849
|
157850
|
157851
|
157852
|
157853