Include %Port% token in default RDP templates (#203)#204
Open
CodyBatt wants to merge 1 commit into
Open
Conversation
Replace the hardcoded 'server port:i:3389' with 'server port:i:%Port%' in the default and example RDP templates. This allows SCALUS to connect using non-default RDP ports specified in the connection URI. Also fix ParseTemplate to preserve values with multiple colons (so custom templates can use formats like %Host%:%Port% in full address if desired), and add a port default of 3389 when no port is specified in standard URIs. Adds a test verifying that custom templates using %Host% (without port) in full address work correctly with server port handling the port separately.
There was a problem hiding this comment.
Pull request overview
This PR enables SCALUS to generate RDP files that honor non-default RDP ports by replacing hardcoded server port:i:3389 with a %Port% token in the default and example templates. It also improves template parsing so values containing multiple colons are preserved (supporting patterns like %Host%:%Port%), and introduces logic intended to default the port to 3389 when not present in a “standard” URI parse.
Changes:
- Update built-in and example
.rdptemplates to useserver port:i:%Port%instead of a hardcoded 3389. - Fix
ParseTemplateto preserve template values containing multiple:characters. - Add a test covering custom templates where the port is applied via
server portonly (not infull address).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/TestDefaultRdpUrlParser.cs | Adds coverage for custom templates that keep full address host-only while using server port for the port. |
| src/UrlParser/DefaultRdpUrlParser.cs | Adds port-defaulting logic for non-RDP URI parsing and fixes template parsing for multi-colon values. |
| src/Resources/Default.rdp | Switches default template to use %Port% for server port. |
| scripts/examples/WinRdpTemplate.rdp | Updates example template to use %Port% for server port. |
| scripts/examples/RdpRemoteAppTemplate.rdp | Updates example template to use %Port% for server port. |
| scripts/examples/exampleRdpTemplate.rdp | Updates example template to use %Port% for server port. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+181
to
+185
| // Ensure port defaults to 3389 if not specified in the URL | ||
| if (!Dictionary.ContainsKey(Token.Port) || string.IsNullOrEmpty(Dictionary[Token.Port])) | ||
| { | ||
| Dictionary[Token.Port] = "3389"; | ||
| } |
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.
Replace the hardcoded 'server port:i:3389' with 'server port:i:%Port%' in the default and example RDP templates. This allows SCALUS to connect using non-default RDP ports specified in the connection URI.
Also fix ParseTemplate to preserve values with multiple colons (so custom templates can use formats like %Host%:%Port% in full address if desired), and add a port default of 3389 when no port is specified in standard URIs.
Adds a test verifying that custom templates using %Host% (without port) in full address work correctly with server port handling the port separately.
Fixes #203