From c86e29470ab2bcfd85445396736636bd9fe54864 Mon Sep 17 00:00:00 2001 From: Ilia Rostovtsev Date: Tue, 23 Apr 2019 16:45:29 +0300 Subject: [PATCH] Fix to store redirects more reliably --- web-lib-funcs.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index e9c309882..f9e8f03a3 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -4924,7 +4924,8 @@ else { $trust = 0; } # Check for trigger URL to simply redirect to root: required for Authentic Theme 19.00+ -if ($ENV{'HTTP_X_REQUESTED_WITH'} ne "XMLHttpRequest" && +if (!$main::redirect_built && + $ENV{'HTTP_X_REQUESTED_WITH'} ne "XMLHttpRequest" && $ENV{'REQUEST_URI'} !~ /xhr/ && $ENV{'REQUEST_URI'} !~ /pjax/ && $ENV{'REQUEST_URI'} !~ /link.cgi\/\d+/ && @@ -4949,10 +4950,11 @@ if ($ENV{'HTTP_X_REQUESTED_WITH'} ne "XMLHttpRequest" && $url = "/" . $url . "/"; } } - # Append hex URL representation to stored file name, to process multiple, simultaneous requests - my $url_salt = substr(unpack("H*", $url), -180); + # Append hex URL representation to stored file name, to process multiple, simultaneous requests + my $url_salt = int(rand() * 10000000); $var{$key} = $url; write_file(tempname('.theme_' . $salt . '_' . $url_salt . '_' . get_product_name() . '_' . $key . '_' . $remote_user), \%var); + $main::redirect_built++ } &redirect($gconfig{'webprefix'} . "/"); }