Feature/add escape handling for devjson#1430
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances Essentials’ developer tooling by (1) improving DeviceJsonApi type conversion to better handle escaped sequences in string/byte-array parameters, and (2) extending the debug websocket session handler to automatically manage CS LAN port forwarding for easier connectivity.
Changes:
- Added
UnescapeStringand updatedConvertTypeto support escape-sequence processing when converting JSON-provided parameters tostringandbyte[]. - Added automatic CS LAN port-forward creation/removal when starting/stopping the debug websocket server.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/PepperDash.Essentials.Core/Web/RequestHandlers/DebugSessionRequestHandler.cs | Automatically adds/removes CS LAN port forwarding when debug websocket starts/stops. |
| src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs | Adds escape-sequence processing for parameter conversion to string/byte[]. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jkdevito
approved these changes
Jun 12, 2026
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.
This pull request introduces enhancements to both device API data handling and the debug websocket server. The most significant changes are improved handling of escape sequences for string and byte array conversions in the device JSON API, and the addition of automatic port forwarding management for the debug websocket server to support connectivity on the CS LAN adapter.
Device JSON API improvements:
UnescapeStringmethod inDeviceJsonApi.csto process escape sequences (like\r,\n,\t, and\xHH) when converting values tostringorbyte[], ensuring that non-printable ASCII characters are handled correctly during type conversion. [1] [2]ConvertTypeto useUnescapeStringforstringandbyte[]conversions, improving robustness when handling JSON input with escape sequences.Debug websocket server enhancements:
DebugSessionRequestHandler.cs, added logic to automatically forward the debug websocket port to the CS LAN adapter when starting the server, improving accessibility for debugging sessions. Handles cases where the CS LAN adapter is not present or errors occur during forwarding.