-
-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: CapacitorSerial Robustness & Hex Validation #4729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Ensure CapacitorSerial instance is fully initialized even without the native plugin, preventing runtime errors when methods are called. All native calls are now guarded.
Validate input hex strings: strip '0x', enforce even length, and check character validity before parsing, throwing descriptive errors on failure.
|
Warning Rate limit exceeded@Erics1337 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 51 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Preview URL: https://pr4729.betaflight-app-preview.pages.dev |
|
haslinghuis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO there is no need to add this change, the protocol cancels in the constructor if not available, as the data format has been established.



Description
This PR improves the robustness of the
CapacitorSerialprotocol adapter. These changes were extracted from #4725 to be merged independently.Changes
this.pluginAvailableinCapacitorSerial.jsmethods (loadDevices,connect,disconnect,send,requestPermissionDevice). This prevents crashes when the nativeBetaflightSerialplugin is missing, such as during browser-based development.hexStringToUint8Arrayto correctly strip optional "0x" prefixes and validate that the input string contains only valid hex characters before parsing.Testing