|
44 | 44 | use App\Settings\SystemSettings\AttachmentsSettings; |
45 | 45 | use Hshn\Base64EncodedFile\HttpFoundation\File\Base64EncodedFile; |
46 | 46 | use Hshn\Base64EncodedFile\HttpFoundation\File\UploadedBase64EncodedFile; |
| 47 | +use Symfony\Component\HttpClient\NoPrivateNetworkHttpClient; |
47 | 48 | use const DIRECTORY_SEPARATOR; |
48 | 49 | use InvalidArgumentException; |
49 | 50 | use RuntimeException; |
@@ -95,6 +96,8 @@ public function __construct( |
95 | 96 | UserAttachment::class => 'user', |
96 | 97 | LabelAttachment::class => 'label_profile', |
97 | 98 | ]; |
| 99 | + |
| 100 | + $this->httpClient = new NoPrivateNetworkHttpClient($this->httpClient); |
98 | 101 | } |
99 | 102 |
|
100 | 103 | /** |
@@ -373,6 +376,7 @@ protected function downloadURL(Attachment $attachment, bool $secureAttachment): |
373 | 376 | ], |
374 | 377 |
|
375 | 378 | ]; |
| 379 | + |
376 | 380 | $response = $this->httpClient->request('GET', $url, $opts); |
377 | 381 | //Digikey wants TLSv1.3, so try again with that if we get a 403 |
378 | 382 | if ($response->getStatusCode() === 403) { |
@@ -434,8 +438,8 @@ protected function downloadURL(Attachment $attachment, bool $secureAttachment): |
434 | 438 | $new_path = $this->pathResolver->realPathToPlaceholder($new_path); |
435 | 439 | //Save the path to the attachment |
436 | 440 | $attachment->setInternalPath($new_path); |
437 | | - } catch (TransportExceptionInterface) { |
438 | | - throw new AttachmentDownloadException('Transport error!'); |
| 441 | + } catch (TransportExceptionInterface $exception) { |
| 442 | + throw new AttachmentDownloadException('Transport error: '.$exception->getMessage()); |
439 | 443 | } |
440 | 444 |
|
441 | 445 | return $attachment; |
|
0 commit comments