Skip to content

Commit

Permalink
Fix query string parsing bug.
Browse files Browse the repository at this point in the history
With some specially-formatted URLs, query strings would be sent to
the server even when they didn't exist.  This has been corrected by
not only checking for $null, but for string length.  Surprisingly,
I wasn't able to reproduce this on all versions of PowerShell that
this module supports.
  • Loading branch information
rhymeswithmogul committed Jun 30, 2022
1 parent 68ae51a commit df30673
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
1 change: 0 additions & 1 deletion COPYING

This file was deleted.

5 changes: 5 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
XSym
0007
9879d6db96fd29134fc802214163b95a
LICENSE

4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
VERSION 1.1.1
- Fixes a bug where query strings might be erroneously detected and sent
to the server, causing resource lookups to fail.

VERSION 1.1
- Adds support for Gopher query strings via the $InputObject parameter.
Previously, one would have to form their own URL with a query string.
Expand Down
4 changes: 2 additions & 2 deletions PSGopher.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
RootModule = 'src/PSGopher.psm1'

# Version number of this module.
ModuleVersion = '1.1.0'
ModuleVersion = '1.1.1'

# Supported PSEditions
CompatiblePSEditions = @('Core', 'Desktop')
Expand Down Expand Up @@ -80,7 +80,7 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = 'This version supports query strings.'
ReleaseNotes = 'This version supports query strings properly.'

# Prerelease string of this module
# Prerelease = ''
Expand Down
5 changes: 4 additions & 1 deletion src/PSGopher.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ Function Invoke-GopherRequest {
#endregion (Content type negotiation)

#region Parse input parameters
If ($null -ne $InputObject) {
If ($null -eq $InputObject -or $InputObject.Length -eq 0) {
Write-Debug 'No query string detected.'
}
Else {
Write-Debug "Found query string=$InputObject"

$Encoder = [Web.HttpUtility]::ParseQueryString('')
Expand Down

0 comments on commit df30673

Please sign in to comment.