]> git.mxchange.org Git - friendica.git/commitdiff
Issue 8254: Some more fixes for too long data for columns
authorMichael <heluecht@pirati.ca>
Sat, 28 Mar 2020 15:14:40 +0000 (15:14 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 28 Mar 2020 15:14:40 +0000 (15:14 +0000)
src/Model/APContact.php
src/Model/Term.php

index 071d9351651b07055d0ff10bd15a2c406a6bcf06..7bf76b03b1ddcc3d4963db10421d06014be4dae8 100644 (file)
@@ -260,6 +260,22 @@ class APContact
                // Unhandled from Kroeg
                // 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['query']);
+                       $apcontact['photo'] = Network::unparseURL($parts);
+
+                       if (strlen($apcontact['photo']) > 255) {
+                               unset($parts['fragment']);
+                               $apcontact['photo'] = Network::unparseURL($parts);
+                       }
+
+                       if (strlen($apcontact['photo']) > 255) {
+                               $apcontact['photo'] = substr($apcontact['photo'], 0, 255);
+                       }
+               }
+
                $parts = parse_url($apcontact['url']);
                unset($parts['path']);
                $baseurl = Network::unparseURL($parts);
index 868f2bf0532380ee8bef06655f8e5e8bd6a594df..84cb1bea7a204d00c5b7aaa06130cd5076822bdd 100644 (file)
@@ -345,7 +345,7 @@ class Term
                                'oid'      => $item_id,
                                'otype'    => self::OBJECT_TYPE_POST,
                                'type'     => $type,
-                               'term'     => $term,
+                               'term'     => substr($term, 0, 255),
                                'url'      => $link,
                                'guid'     => $item['guid'],
                                'created'  => $item['created'],