Skip to content

Commit

Permalink
Merge pull request #4734 from ms609/GlazerMann-patch-1
Browse files Browse the repository at this point in the history
ignore junk website names
  • Loading branch information
GlazerMann authored Dec 20, 2024
2 parents 76820c8 + f71c447 commit 6e445d2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Zotero.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,16 @@ public static function process_zotero_response(string $zotero_response, Template
}
if (stripos($url, 'tumblr.com') !== false) {
$result->itemType = 'webpage'; // @codeCoverageIgnore
}
}

// Ignore junk website names
if (isset($result->publicationTitle) && preg_match('~^https?://([^/]+)~', $url, $hostname) === 1) {
$hostname = str_ireplace('www.', '', (string) $hostname[1]);
$pub_name = str_ireplace('www.', '', (string) $result->publicationTitle);
if (str_i_same($pub_name, $hostname)) {
unset($result->publicationTitle);
}
}

// Reject if we find more than 5 or more than 10% of the characters are �. This means that character
// set was not correct in Zotero and nothing is good. We allow a couple of � for German umlauts that arer easily fixable by humans.
Expand Down

0 comments on commit 6e445d2

Please sign in to comment.