diff options
author | Dave Arter <davea@mysociety.org> | 2020-02-04 15:38:24 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2020-02-10 09:54:55 +0000 |
commit | b91a0b4ee71c8f8f2bd2c03ae6fff7249303722c (patch) | |
tree | 0bf9ef3028f04c4b8f3b7611cb15c48be494499e /perllib/FixMyStreet/Template/SafeString.pm | |
parent | 806a1b638539d846eca693f97c63c272360bd361 (diff) |
[Zürich] Fix crash on certain /report/ajax/<id> URLs
Attempting to load the /report/ajax/<id> URL for a problem that
had a public response and wasn't in the ‘external’ state was causing
a crash because the call to FixMyStreet::App::View::Web::add_links
in updates_as_hashref was returning a FixMyStreet::Template::SafeString
that the JSON module didn't know how to serialise.
This commit adds a TO_JSON method to SafeString, and ensures the output
of /report/ajax is JSON-encoded with convert_blessed turned on so the
TO_JSON method is called.
Diffstat (limited to 'perllib/FixMyStreet/Template/SafeString.pm')
-rw-r--r-- | perllib/FixMyStreet/Template/SafeString.pm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Template/SafeString.pm b/perllib/FixMyStreet/Template/SafeString.pm index 619bee048..263937b39 100644 --- a/perllib/FixMyStreet/Template/SafeString.pm +++ b/perllib/FixMyStreet/Template/SafeString.pm @@ -69,6 +69,12 @@ sub clone { return $clone; } +sub TO_JSON { + my $self = shift; + + return $$self; +} + 1; __END__ |