Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore junk website names #4734

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Zotero.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,16 @@
}
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);

Check warning on line 560 in Zotero.php

View check run for this annotation

Codecov / codecov/patch

Zotero.php#L560

Added line #L560 was not covered by tests
}
}

// 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
Loading