Exceptions and warnings fixed
This commit is contained in:
parent
ac087749e3
commit
8cf82a8449
|
@ -259,7 +259,7 @@ class Email
|
||||||
|
|
||||||
if ((isset($params['filename']) && $params['filename']) || (isset($params['name']) && $params['name'])) {
|
if ((isset($params['filename']) && $params['filename']) || (isset($params['name']) && $params['name'])) {
|
||||||
// filename may be given as 'Filename' or 'Name' or both
|
// filename may be given as 'Filename' or 'Name' or both
|
||||||
$filename = ($params['filename'])? $params['filename'] : $params['name'];
|
$filename = $params['filename'] ?? $params['name'];
|
||||||
// filename may be encoded, so see imap_mime_header_decode()
|
// filename may be encoded, so see imap_mime_header_decode()
|
||||||
$attachments[$filename] = $data; // this is a problem if two files have same name
|
$attachments[$filename] = $data; // this is a problem if two files have same name
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,12 @@ class ParseUrl
|
||||||
return $siteinfo;
|
return $siteinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
$curlResult = DI::httpClient()->get($url, HttpClientAccept::HTML, [HttpClientOptions::CONTENT_LENGTH => 1000000]);
|
$curlResult = DI::httpClient()->get($url, HttpClientAccept::HTML, [HttpClientOptions::CONTENT_LENGTH => 1000000]);
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
Logger::info('Exception when fetching', ['url' => $url, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
|
||||||
|
return $siteinfo;
|
||||||
|
}
|
||||||
if (!$curlResult->isSuccess() || empty($curlResult->getBodyString())) {
|
if (!$curlResult->isSuccess() || empty($curlResult->getBodyString())) {
|
||||||
Logger::info('Empty body or error when fetching', ['url' => $url, 'success' => $curlResult->isSuccess(), 'code' => $curlResult->getReturnCode()]);
|
Logger::info('Empty body or error when fetching', ['url' => $url, 'success' => $curlResult->isSuccess(), 'code' => $curlResult->getReturnCode()]);
|
||||||
return $siteinfo;
|
return $siteinfo;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user