Skip to content

Commit a18cd0f

Browse files
authored
Merge pull request #102 from jtojnar/local-no-domain
Do not set domainRegExp for local files
2 parents 4258559 + c7208f6 commit a18cd0f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Readability.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,10 @@ private function loadHtml(): void
13831383
$this->logger->debug('Parsing URL: ' . $this->url);
13841384

13851385
if ($this->url) {
1386-
$this->domainRegExp = '/' . strtr((string) preg_replace('/www\d*\./', '', (string) parse_url($this->url, \PHP_URL_HOST)), ['.' => '\.']) . '/';
1386+
$host = parse_url($this->url, \PHP_URL_HOST);
1387+
if (null !== $host) {
1388+
$this->domainRegExp = '/' . strtr((string) preg_replace('/www\d*\./', '', $host), ['.' => '\.']) . '/';
1389+
}
13871390
}
13881391

13891392
mb_internal_encoding('UTF-8');

0 commit comments

Comments
 (0)