AtlassianPS / JiraPS

PowerShell module to interact with Atlassian JIRA
https://AtlassianPS.org/module/JiraPS
MIT License
323 stars 131 forks source link

Set-JiraConfigServer failes when there are no `/` in the server name #332

Closed michalporeba closed 5 years ago

michalporeba commented 5 years ago

Description

When value of the server doesn't have / in the name an exception is thrown.

Steps To Reproduce

image

Your Environment

PS C:\> Get-Module JiraPS -ListAvailable | Select Name, Version

Name   Version
----   -------
JiraPS 2.9.0
JiraPS 2.8.6
lipkau commented 5 years ago

Hi.

This is working correctly. The reason why it is not working, is because you did not provide the schema of the url. If you add the https://, it should work fine

lipkau commented 5 years ago

Please reopen if the problem was not resolved

michalporeba commented 5 years ago

I think it would be a nice to have not to have to specify the schema, but if that's what it needs then it resolves my problem. Thank you.

lipkau commented 5 years ago

the module is using [URI]$Uri. the constructor of the class does not default to a schema (say: https) if it's not provided.

of course, the module could use it as a string. I will take it into consideration for v3

image

michalporeba commented 5 years ago

You could review the string and if it doesn't start with schema simply prepend it with https:// for example. Another step could be to try if it works and if not try http:// before returning an error.

On Sat, 26 Jan 2019, 10:23 Oliver Lipkau <notifications@github.com wrote:

the module is using [URI]$Uri. the constructor of the class does not default to a schema (say: https) if it's not provided.

of course, the module could use it as a string. I will take it into consideration for v3

[image: image] https://user-images.githubusercontent.com/4992870/51785875-bf32dc00-215c-11e9-932e-9c8870fcc577.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AtlassianPS/JiraPS/issues/332#issuecomment-457819686, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHYMBp88eGQEM0J9-OJMo-gLj65D6vIks5vHCyKgaJpZM4aKTdB .

lipkau commented 5 years ago

Another step could be to try if it works and if not try http:// before returning an error.

definitely not! the module uses basic auth to authenticate. in an http connection, the credentials can be read. Ideally, I would remove support for non-tls secured connections. but for now I have only placed this in the documentation

You could review the string and if it doesn't start with schema simply prepend it with https:// for example.

That's what the screenshot shows, but using the [URI] class. This allows me not the have to validate the format of the string