You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an URL contains a encoded forward slash (e.g. /job/john%2f117) and a route like /job/:jobName exists, the route is never hit because the server decodes the forward slash before determining the correct route.
The requests log shows GET /job/john/117 HTTP/1.1 404
In our case we have a route group with several routes like /job/:jobName, /job/:jobName/objects, etc.
As the values of jobName came from another system, which we can't influence, some names contains a forward slash.
Steps To Reproduce
Steps to reproduce the behavior:
Create a server file with the following content.
Start-PodeServer {
Add-PodeEndpoint-Address "127.0.0.1"-Port 8080-Protocol Http
Add-PodeRoute-Method Get -Path "/job/:jobName"-ScriptBlock {
$JobName=$WebEvent.Parameters["jobName"]
Write-PodeJsonResponse-Value @{"message"="jobname route for $($JobName) was reached."}
}
Add-PodeRoute-Method Get -Path "/job/:jobName/objects"-ScriptBlock {
$JobName=$WebEvent.Parameters["jobName"]
Write-PodeJsonResponse-Value @{"message"="objects route for $($JobName) was reached."}
}
}
Describe the Bug
If an URL contains a encoded forward slash (e.g.
/job/john%2f117
) and a route like/job/:jobName
exists, the route is never hit because the server decodes the forward slash before determining the correct route.The requests log shows
GET /job/john/117 HTTP/1.1 404
In our case we have a route group with several routes like
/job/:jobName
,/job/:jobName/objects
, etc.As the values of
jobName
came from another system, which we can't influence, some names contains a forward slash.Steps To Reproduce
Steps to reproduce the behavior:
Expected Behavior
A JSON response should be returned:
Platform
Additional Context
Issue #558 and PR #560 are related, since this PR included the
[System.Web.HttpUtility]::UrlDecode
method for the URIThe text was updated successfully, but these errors were encountered: