ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
198 stars 153 forks source link

Fix win_zip backslash issue #506

Closed hiyokotaisa closed 1 year ago

hiyokotaisa commented 1 year ago
SUMMARY

Fixes #442

ISSUE TYPE
COMPONENT NAME

win_zip

ADDITIONAL INFORMATION

From .NET 4.6.1, Windows is able to swich path separater from backslash to forwardslash. https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/mitigation-ziparchiveentry-fullname-path-separator

So I added [System.AppContext]::SetSwitch('Switch.System.IO.Compression.ZipFile.UseBackslash', $false) to use forwardslash forcibly to avoid warning when extracting in non-windows environment.