aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Model
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2019-04-05 18:49:32 +0100
committerDave Arter <davea@mysociety.org>2019-06-06 11:59:21 +0100
commitff3b747698f577876bff25512ac137c6677ccab7 (patch)
tree8d11c4376cbb2d7a60b79c94fc9827ef3c417d81 /perllib/FixMyStreet/App/Model
parent1a1be49646218b2217e25e82e6666749f78dc612 (diff)
[Hounslow] Add general enquiries functionality
This functionality allows a cobrand to replace the /contact form with a form that creates hidden reports which are sent via Open311. The form also allows file uploads in addition to photos. This functionality is currently enabled for the Hounslow cobrand and others cobrands can enable it by defining setup_general_enquiries_stash which primarily sets up the appropriate categories and default values for the report.
Diffstat (limited to 'perllib/FixMyStreet/App/Model')
-rw-r--r--perllib/FixMyStreet/App/Model/PhotoSet.pm19
1 files changed, 2 insertions, 17 deletions
diff --git a/perllib/FixMyStreet/App/Model/PhotoSet.pm b/perllib/FixMyStreet/App/Model/PhotoSet.pm
index 8621286b0..1d9ccd7cd 100644
--- a/perllib/FixMyStreet/App/Model/PhotoSet.pm
+++ b/perllib/FixMyStreet/App/Model/PhotoSet.pm
@@ -121,23 +121,8 @@ has ids => ( # Arrayref of $fileid tuples (always, so post upload/raw data proc
return ();
}
- # base64 decode the file if it's encoded that way
- # Catalyst::Request::Upload doesn't do this automatically
- # unfortunately.
- my $transfer_encoding = $upload->headers->header('Content-Transfer-Encoding');
- if (defined $transfer_encoding && $transfer_encoding eq 'base64') {
- my $decoded = decode_base64($upload->slurp);
- if (open my $fh, '>', $upload->tempname) {
- binmode $fh;
- print $fh $decoded;
- close $fh
- } else {
- my $c = $self->c;
- $c->log->info('Couldn\'t open temp file to save base64 decoded image: ' . $!);
- $c->stash->{photo_error} = _("Sorry, we couldn't save your image(s), please try again.");
- return ();
- }
- }
+ # Make sure any base64 encoding is handled.
+ FixMyStreet::PhotoStorage::base64_decode_upload($self->c, $upload);
# get the photo into a variable
my $photo_blob = eval {