RamblingCookieMonster / RabbitMQTools

PowerShell module containing cmdlets to manage RabbitMQ.
http://ramblingcookiemonster.github.io/RabbitMQ-Intro/
MIT License
31 stars 22 forks source link

Get-RabbitMQQueue Queuename doesn't allow space #44

Open mooock opened 5 years ago

mooock commented 5 years ago

when using something like this

$Queue = 'Subscription for 2fc8e48a-0a10-40dd-aeb9-a2f552136243e5#8' Get-RabbitMQMessage -VirtualHost $VirtualHost -Name $Queue -Count 1 -Credential $RMQCRED -BaseUri $RMQURI -Encoding auto -View Default

i receive this Invoke-RestMethod : {"error":"not_found","reason":"NOT_FOUND - no queue 'Subscription+for+2fc8e48a-0a10-40dd-aeb9-a2f552136243e5#8' in vhost 'RMQ_TEST'"} At line:131 char:13

it looks like the + sign is translated

mooock commented 5 years ago

Found the issue in

$url = Join-Parts $BaseUri "/api/queues/$([System.Web.HttpUtility]::UrlEncode($VirtualHost))/$([uri]::EscapeDataString("$Name"))/get"

instead of using the .Net class [System.Web.HttpUtility]::UrlEncode use [uri]::EscapeDataString for translating it a space to %20 and not +