Skip to content

Commit

Permalink
Truncate annotation page label instead of error
Browse files Browse the repository at this point in the history
Truncates annotationPageLabel to be at most maxAnnotationPageLabelLength so the error is not thrown if annotation page label is too long.
Fixes: zotero#131
  • Loading branch information
abaevbog committed Jun 14, 2023
1 parent 2cf66c3 commit f342705
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions model/Items.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f342705

Please sign in to comment.