fix: handle missing annotationKey in newer Zotero annotation format#461
Open
yukiizumi3 wants to merge 1 commit intoPKM-er:masterfrom
Open
fix: handle missing annotationKey in newer Zotero annotation format#461yukiizumi3 wants to merge 1 commit intoPKM-er:masterfrom
yukiizumi3 wants to merge 1 commit intoPKM-er:masterfrom
Conversation
Newer versions of Zotero (7+) embed annotation references in notes without the `annotationKey` field, using `pageLabel` + `position` instead. This caused the note parser to crash with: "Unexpected annotation data: annotationKey must be defined" Changes: - Make `annotationKey` optional in DataAnnotation schema, accept `pageLabel` and `position` fields from newer format - Preserve highlight text content when annotationKey is missing instead of returning empty string - Generate page-level PDF links as fallback when annotation-level links are unavailable - Gracefully degrade without breaking existing behavior for older Zotero versions that still include annotationKey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
annotationKeyfield, usingpageLabel+positioninsteadUnexpected annotation data: annotationKey must be definedannotationKeyoptional, preserves highlight text content, and generates page-level PDF links as fallbackChanges
format.tsannotationKeyoptional inDataAnnotationschemapageLabelandpositionas optional fields to accept the newer formatservice.tshighlightTextandpageLabelfields to the annotations mapannotationKeyis missing: renders the highlight text with a page-level PDF link instead of crashingannotationKeyTest plan
annotationKey)annotationKey) still work correctly