Fix to store redirects more reliably

This commit is contained in:
Ilia Rostovtsev
2019-04-23 16:45:29 +03:00
parent 06f74a28cb
commit c86e29470a

View File

@@ -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'} . "/");
}