Fix: Accept numeric version field in AnkiConnect API requests#90
Fix: Accept numeric version field in AnkiConnect API requests#90mallomar wants to merge 2 commits into
Conversation
KOReader sends version as a number per the AnkiConnect API spec. Made JSON parser lenient to accept both numeric and string version fields for compatibility.
|
Hi @KamWithK, any progress on the merge? Thanks! |
|
Facing the same issue. Would be great if this could be merged, if the maintainer is happy with the changes. |
Have you tested the changes? |
Hi @KamWithK,
The fix has two parts:
Happy to add a unit test for the parser if that would help with review, or to test a built APK if you can produce one. Let me know what would be most useful. |
Sorry what? I have limited time, set up your machine properly and test your changes before you submit a PR |
Fair enough on testing expectations. The blocker on my end is that I don’t have an Android dev environment set up, and the repo doesn’t produce build artifacts on PRs, so there’s no APK to sideload. Setting up Android Studio from scratch to test a parser change isn’t something I’m able to take on right now. Leaving the PR open in case it’s useful to someone with the build setup, or if you’d like to produce a debug APK from this branch I’m happy to test it on my end with both Yomitan and KOReader and report back. |
Fixes KOReader Anki plugin compatibility by accepting numeric
versionfields in API requests.Problem
KOReader sends
{"version":6,"action":"requestPermission"}with version as a number (per the official AnkiConnect API spec), but AnkiConnect Android was rejecting this with a MalformedJsonException at column 14 (immediately after the numeric 6).Solution
get_version()to explicitly handle both number and string types for the version fieldTesting
Related issue: #89