Skip to content

Commit

Permalink
[Surrey] Don’t fetch & upload photos from media_url
Browse files Browse the repository at this point in the history
Photos should only be uploaded if the photo content was
POSTed from FMS.
  • Loading branch information
davea committed Sep 17, 2024
1 parent 39cd0e1 commit 805c9d5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
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 805c9d5

Please sign in to comment.