chef / chef/mixlib-install

Wrong filename from a custom url

Open
#307 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Untriaged Type: Bug
Dominant language
Ruby
Stars
13
Forks
55
Avg merge
2d 15h
Merged PRs (30d)
8

Description

Version:

Using version ~> 3.11 from chef_client_updater v3.8.4

Environment:

Windows 10

Scenario:

I'm using the cookbook attribute download_url_override as url: https://my.cloud/index.php/s/8yo7sEwDoJf32TN/download?path=chef-client&files=chef-client-latest-x64.msi - to download the chef-client.

Steps to Reproduce:

Use a download url like above.

Expected Result:

Save and download the file with the correct filename and complete the chef upgrade.

Actual Result:

The filename gets resolved to Filename: download?path=chef-client&files=chef-client-latest-x64.msi and cannot be downloaded because of illegal chars in the path:

Downloading chef from https://my.cloud/index.php/s/8yo7sEwDoJf32TN/download?path=chef-client&files=chef-client-latest-x64.msi to C:\Users\myuser\AppData\Local\Temp\download?path=chef-client&files=chef-client-latest-x64.msi.

Filename should be: chef-client-latest-x64.msi

Code:
https://github.com/chef/mixlib-install/blob/13bbdce54ef9e48a0cf25bccc4152bf76abbfaaa/lib/mixlib/install/generator/powershell/scripts/install_project.ps1.erb#L94

PS:

$download_url = "https://my.cloud/index.php/s/8yo7sEwDoJf32TN/download?path=chef-client&files=chef-client-latest-x64.msi"
PS C:\opscode> ($download_url -split '/')[-1]
download?path=chef-client&files=chef-client-latest-x64.msi

Greetz

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at lib/mixlib/install/generator/powershell/scripts/install_project.ps1.erb around line 94 and reproduce how the custom URL is split into a filename. Check the generated PowerShell installer with the reported URL; done means it saves the file as chef-client-latest-x64.msi and completes the Chef upgrade without illegal path characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, ruby
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.