Skip to content

Commit

Permalink
[BUGFIX] Catch exception when fetching external image
Browse files Browse the repository at this point in the history
The fetching of an external file with GeneralUtility::getUrl()
may throw an exception if the image is not available (at least
since Guzzle is used internally with TYPO3 and libcurl is installed).

The exception is now caught. If the exception occurs no further
processing on the image is done.

Resolves: netresearch#190
  • Loading branch information
sypets authored and CybotTM committed Oct 17, 2022
1 parent a374f43 commit 8f9fc92
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Classes/Database/RteImagesDbHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ public function transform_db($value)
) {
// External image from another URL: in that case, fetch image, unless the feature is disabled or we are not in backend mode
// Fetch the external image
$externalFile = GeneralUtility::getUrl($absoluteUrl);
$externalFile = null;
try {
$externalFile = GeneralUtility::getUrl($absoluteUrl);
} catch (\Throwable $e) {
// do nothing, further image processing will be skipped
}
if ($externalFile) {
$pU = parse_url($absoluteUrl);
$path = is_array($pU) ? ($pU['path'] ?? '') : '';
Expand Down

0 comments on commit 8f9fc92

Please sign in to comment.