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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2023-10-24 10:49:44 +01:00 committed by Tomas Cohen Arazi
parent 9d236a20f2
commit 0f3e68f75f
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -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;