-
Notifications
You must be signed in to change notification settings - Fork 100
Description
Brief description of your issue
WingetCreate new does not download a file even though you can download the file in Edge browser. File can be downloaded without authentication to the website.
Steps to reproduce
when using "WingetCreate new" with the url "https://httpbin.org/user-agent" returns no user-agent string.
This is what it returns.
{
"user-agent": ""
}
This causes downloads not to be downloaded because it is a standard practice to identify oneself to the internet server. Most sites interrogate and can present different content (or deny content) based upon the user-agent string. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/User-Agent
Example is Atlassian Jira download - https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-9.12.25-x64.exe
Download with Edge user agent string
$userAgent = $AgentStringForEdge"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0"
Invoke-WebRequest -Uri $url -OutFile New-TemporaryFile -Headers @{ "User-Agent" = $userAgent }
Successful Download
Download with PowerShell user agent string
$userAgent = "Mozilla/5.0 (Windows NT; Windows NT 10.0; en-US) WindowsPowerShell/5.1.26100.4652"
Invoke-WebRequest -Uri $url -OutFile New-TemporaryFile -Headers @{ "User-Agent" = $userAgent }
Successful Download
Download with WingetCreate user agent string
$userAgent = ""
Invoke-WebRequest -Uri $url -OutFile New-TemporaryFile -Headers @{ "User-Agent" = $userAgent }
Failed - 403 Error##
Expected behavior
WingetCreate New would be able to download the file and continue building winget package.
Actual behavior
Wingetcreate new returns "Failed to download installer.
HTTP response was unsuccessful. Status code: Forbidden"
Environment
Windows Package Manager Manifest Creator v1.9.14.0
Operating System: Microsoft Windows NT 10.0.26100.0
System Architecture: X64