Merge pull request #8462 from annando/issue-8254-3

Issue 8254: Some more fixes for too long data for columns
This commit is contained in:
Hypolite Petovan 2020-03-29 00:32:03 -04:00 committed by GitHub
commit 1d8bb726d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -260,6 +260,22 @@ class APContact
// Unhandled from Kroeg // Unhandled from Kroeg
// kroeg:blocks, updated // kroeg:blocks, updated
// When the photo is too large, try to shorten it by removing parts
if (strlen($apcontact['photo']) > 255) {
$parts = parse_url($apcontact['photo']);
unset($parts['fragment']);
$apcontact['photo'] = Network::unparseURL($parts);
if (strlen($apcontact['photo']) > 255) {
unset($parts['query']);
$apcontact['photo'] = Network::unparseURL($parts);
}
if (strlen($apcontact['photo']) > 255) {
$apcontact['photo'] = substr($apcontact['photo'], 0, 255);
}
}
$parts = parse_url($apcontact['url']); $parts = parse_url($apcontact['url']);
unset($parts['path']); unset($parts['path']);
$baseurl = Network::unparseURL($parts); $baseurl = Network::unparseURL($parts);

View file

@ -345,7 +345,7 @@ class Term
'oid' => $item_id, 'oid' => $item_id,
'otype' => self::OBJECT_TYPE_POST, 'otype' => self::OBJECT_TYPE_POST,
'type' => $type, 'type' => $type,
'term' => $term, 'term' => substr($term, 0, 255),
'url' => $link, 'url' => $link,
'guid' => $item['guid'], 'guid' => $item['guid'],
'created' => $item['created'], 'created' => $item['created'],