From f34270593399700e36a5965843935979bccde98d Mon Sep 17 00:00:00 2001 From: Bogdan Abaev Date: Wed, 14 Jun 2023 15:04:28 -0400 Subject: [PATCH] Truncate annotation page label instead of error Truncates annotationPageLabel to be at most maxAnnotationPageLabelLength so the error is not thrown if annotation page label is too long. Fixes: #131 --- model/Items.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/model/Items.inc.php b/model/Items.inc.php index df08d0c6..cc8609b2 100644 --- a/model/Items.inc.php +++ b/model/Items.inc.php @@ -1849,12 +1849,15 @@ public static function updateFromJSON(Zotero_Item $item, case 'annotationText': case 'annotationComment': case 'annotationColor': - case 'annotationPageLabel': case 'annotationSortIndex': case 'annotationPosition': $item->$key = $val; break; - + + case 'annotationPageLabel': + $item->$key = substr($val, 0, Zotero_Items::$maxAnnotationPageLabelLength); + break; + case 'dateModified': if ($apiVersion >= 3 && $tmpZoteroClientDateModifiedHack) { $item->setField($key, $val);