+
Skip to content

Allow general URL to import JCCommands from. -- receiving '400: Invalid request' #472

@flybyray

Description

@flybyray

'The URL of the JumpCloud command to import into a JumpCloud tenant.' see

[Parameter(ParameterSetName = 'URL', Mandatory, Position = 0, ValueFromPipelineByPropertyName = $True, HelpMessage = 'The URL of the JumpCloud command to import into a JumpCloud tenant.')]

command:

Import-JCCommand -URL "http://localhost:9000/JumpCloud_Commands/Mac%20Commands/Mac%20-%20List%20additional%20routes%20from%20vpn.md"

error and stacktrace:

Invoke-WebRequest: /home/username/.local/share/powershell/Modules/JumpCloud/2.2.0/Private/NestedFunctions/New-JCCommandFromURL.ps1:20
Line |
  20 |  … UrlInvoke = Invoke-WebRequest -Uri $rawUrl -UseBasicParsing -UserAgen …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | 400: Invalid request
InvalidOperation: /home/username/.local/share/powershell/Modules/JumpCloud/2.2.0/Private/NestedFunctions/New-JCCommandFromURL.ps1:24
Line |
  24 |          $Name = $content[0].Groups[2].Value #Name
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot index into a null array.
InvalidOperation: /home/username/.local/share/powershell/Modules/JumpCloud/2.2.0/Private/NestedFunctions/New-JCCommandFromURL.ps1:25
Line |
  25 |          $commandType = $content[1].Groups[2].Value #CommandType
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot index into a null array.
InvalidOperation: /home/username/.local/share/powershell/Modules/JumpCloud/2.2.0/Private/NestedFunctions/New-JCCommandFromURL.ps1:26
Line |
  26 |          $Command = $content[2].Groups[3].Value #Command
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot index into a null array.

reason:

$httpUrl = $GitHubURL | Select-String -Pattern "\bmaster.*$" | % { $_.Matches } | % { $_.Value }
$rawUrl = "https://raw.githubusercontent.com/TheJumpCloud/support/$httpUrl"

URL is transformed and not a general URL is expected as described by help text.

Could you allow to import JC Commands from different URLs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载