aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Response.pm
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2017-05-28 21:31:42 +0200
committerMarius Halden <marius.h@lden.org>2017-05-28 21:31:42 +0200
commit987124b09a32248414faf4d0d6615d43b29ac6f6 (patch)
treea549db8af723c981d3b346e855f25d6fd5ff8aa7 /perllib/FixMyStreet/App/Response.pm
parentdbf56159e44c1560a413022451bf1a1c4cb22a52 (diff)
parenta085b63ce09f87e83b75cda9b9cd08aadfe75d61 (diff)
Merge tag 'v2.0.4' into fiksgatami-dev
Diffstat (limited to 'perllib/FixMyStreet/App/Response.pm')
-rw-r--r--perllib/FixMyStreet/App/Response.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Response.pm b/perllib/FixMyStreet/App/Response.pm
new file mode 100644
index 000000000..16ebf995f
--- /dev/null
+++ b/perllib/FixMyStreet/App/Response.pm
@@ -0,0 +1,27 @@
+# This package exists to try and work around a big bug in Edge:
+# https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8572187/
+
+package FixMyStreet::App::Response;
+use Moose;
+extends 'Catalyst::Response';
+
+around 'redirect' => sub {
+ my $orig = shift;
+ my $self = shift;
+ my ($location, $status) = @_;
+
+ return $self->$orig() unless @_; # getter
+
+ my $agent = $self->_context->request->user_agent;
+ return $self->$orig(@_) unless $agent =~ /Edge\/14/; # Only care about Edge
+
+ # Instead of a redirect, output HTML that redirects
+ $self->body(<<END
+<meta http-equiv="refresh" content="0; url=$location">
+Please follow this link: <a href="$location">$location</a>
+END
+ );
+ return $location;
+};
+
+1;