[bugzilla-gnome-org-customizations/production] don't redirect for splinter requests (bug 744232)



commit 91b074b56f9ceb5751d170a4d2670b576a2d10bd
Author: Olav Vitters <olav vitters nl>
Date:   Tue Feb 10 14:51:50 2015 +0100

    don't redirect for splinter requests (bug 744232)

 extensions/Splinter/lib/Ops.pm |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/extensions/Splinter/lib/Ops.pm b/extensions/Splinter/lib/Ops.pm
index 8332c85..4a597bf 100644
--- a/extensions/Splinter/lib/Ops.pm
+++ b/extensions/Splinter/lib/Ops.pm
@@ -181,4 +181,21 @@ sub add_dispatch {
     $dispatches->{'Splinter'} = "Bugzilla::Extension::Splinter::WebService";
 }
 
+sub splinter_use_attachbase {
+    my $cgi = Bugzilla->cgi;
+    my $attachbase = Bugzilla->params->{'attachment_base'};
+    my $urlbase = Bugzilla->params->{'urlbase'};
+    my $sslbase = Bugzilla->params->{'sslbase'};
+
+    my $splinter_regexp = $sslbase ? qr/^(\Q$urlbase\E|\Q$sslbase\E)review/ : qr/^\Q$urlbase\Ereview/;
+
+    return ($attachbase ne ''
+            && $attachbase ne $urlbase
+            && $attachbase ne $sslbase
+            && $cgi->referer !~ /$splinter_regexp/) ? 1 : 0;
+
+BEGIN {
+        *Bugzilla::Util::use_attachbase = \&splinter_use_attachbase;
+}
+
 1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]