Skip to content

Commit

Permalink
Merge branch 'surrey-only-send-private-photos' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
davea committed Sep 17, 2024
2 parents ac2709c + 805c9d5 commit 4fd0103
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
5 changes: 4 additions & 1 deletion perllib/Integrations/Surrey/Boomi.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ has ua => (
is => 'rw',
default => sub {
my $self = shift;
my $ua = LWP::UserAgent->new(agent => "FixMyStreet/open311-adapter");
my $ua = LWP::UserAgent->new(
agent => "FixMyStreet/open311-adapter",
timeout => 3 * 60, # Boomi can take longer than the default 60s when handling large/multiple photos.
);
$ua->ssl_opts(SSL_cipher_list => 'DEFAULT:!DH'); # Disable DH ciphers, server's key is too small apparently
my $hash = encode_base64($self->config->{username} . ':' . $self->config->{password}, "");
$ua->default_header('Authorization' => "Basic $hash");
Expand Down
8 changes: 0 additions & 8 deletions perllib/Open311/Endpoint/Integration/Boomi.pm
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,8 @@ sub _add_attachments {
my $ua = LWP::UserAgent->new(agent => "FixMyStreet/open311-adapter");

for my $photo (@{ $args->{media_url} }) {
my $photo_response = $ua->get($photo);
unless ( $photo_response->is_success) {
$self->logger->error("Failed to retrieve photo from $photo\n");
die "Failed to retrieve photo from $photo";
}

push @attachments, {
fileName => $photo_response->filename,
url => $photo,
base64 => encode_base64($photo_response->content),
};
}

Expand Down
4 changes: 0 additions & 4 deletions t/open311/endpoint/surrey_boomi.t
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ $lwp->mock(request => sub {
"attachments" => [
{
"url" => "http://localhost/photo/one.jpeg",
"fileName" => "1.jpeg",
"base64" => "/9j/4AAQSkZJRgABAQAAAAAAAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkI\nCQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/wAALCAABAAEBAREA/8QAFAABAAAAAAAA\nAAAAAAAAAAAACf/EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAD8AKp//2Q==\n",
},
]
};
Expand Down Expand Up @@ -133,8 +131,6 @@ $lwp->mock(request => sub {
"attachments" => [
{
"url" => "http://localhost/photo/one.jpeg",
"fileName" => "1.jpeg",
"base64" => "/9j/4AAQSkZJRgABAQAAAAAAAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkI\nCQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/wAALCAABAAEBAREA/8QAFAABAAAAAAAA\nAAAAAAAAAAAACf/EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAD8AKp//2Q==\n",
},
]
};
Expand Down

0 comments on commit 4fd0103

Please sign in to comment.