microsoft / winget-create

The Windows Package Manager Manifest Creator command-line tool (aka wingetcreate)
MIT License
503 stars 85 forks source link

Fix null/empty filename string when downloading package file #293

Closed ryfu-msft closed 2 years ago

ryfu-msft commented 2 years ago

Fixes #292

The changes in this PR fix an issue where the target filename used to create the package file is null. This can cause an UnauthorizedAccessException since an empty filename means that the File.OpenWrite is trying to write to a directory instead of a file. To resolve this, I use the filename from the requestUrl as the last option for the filename in case both the contentDispositionFile and urlFile names are both empty.

Verified manually with the related issue.

Microsoft Reviewers: Open in CodeFlow