Merge pull request #102 from jtojnar/local-no-domain

Do not set domainRegExp for local files
This commit is contained in:
Jérémy Benoist
2025-03-04 10:20:15 +01:00
committed by GitHub
+4 -1
View File
@@ -1383,7 +1383,10 @@ class Readability implements LoggerAwareInterface
$this->logger->debug('Parsing URL: ' . $this->url); $this->logger->debug('Parsing URL: ' . $this->url);
if ($this->url) { if ($this->url) {
$this->domainRegExp = '/' . strtr((string) preg_replace('/www\d*\./', '', (string) parse_url($this->url, \PHP_URL_HOST)), ['.' => '\.']) . '/'; $host = parse_url($this->url, \PHP_URL_HOST);
if (null !== $host) {
$this->domainRegExp = '/' . strtr((string) preg_replace('/www\d*\./', '', $host), ['.' => '\.']) . '/';
}
} }
mb_internal_encoding('UTF-8'); mb_internal_encoding('UTF-8');