Skip to content

Branch names with '/' in them cause errors due to unescaped use as file path #21

Description

@NetzwergX
PS> Install-ModuleFromGitHub -GitHubRepo NetzwergX/Windows-Screenfetch -Branch 'fix/Get-Uptime' -Debug                  
Invoke-RestMethod: <redacted>\PowerShell\Modules\InstallModuleFromGitHub\0.3\InstallModuleFromGitHub.psm1:28                                                                                                                   Line |                                                                                                                    28 |                  Invoke-RestMethod $url -OutFile $OutFile                                                             |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                             | Could not find a part of the path '<redacted>\win-screenfetch\fix\Get-Uptime.zip'.                                                                                                                                                       Unblock-File: <redacted>\PowerShell\Modules\InstallModuleFromGitHub\0.3\InstallModuleFromGitHub.psm1:29
Line |
  29 |                  Unblock-File $OutFile
     |                  ~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path '<redacted>\win-screenfetch\fix\Get-Uptime.zip' because it does not exist.

Expand-Archive: <redacted>\PowerShell\Modules\InstallModuleFromGitHub\0.3\InstallModuleFromGitHub.psm1:30
Line |
  30 |  …             Expand-Archive -Path $OutFile -DestinationPath $pwd -Forc …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The path '<redacted>\win-screenfetch\fix/Get-Uptime.zip' either does not exist or is not a valid file
     | system path.

Get-ChildItem: <redacted>\PowerShell\Modules\InstallModuleFromGitHub\0.3\InstallModuleFromGitHub.psm1:36
Line |                                                                                                                    
  36 |                  $psd1=ls $targetModule *.psd1                                                                        
     |                        ~~~~~~~~~~~~~~~~~~~~~~~                                                                       
     | Cannot find path '<redacted>\win-screenfetch\Windows-Screenfetch-fix\Get-Uptime' because it does not                  
     | exist.

Using the branch name for the file doesn't work when the branch contains a slash. Using branches like release/x, feature/x or fix/x is not uncommon and should be supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions