-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
win_get_url doesn't get correct filename for URL's containing parameters #575
Comments
That's the expected results right now. If you specify $url = "https://foo/agent-download?filename=19.15-69/Windows/FS/fsagent1915_win_x64.zip"
Split-Path -Path ([Uri]$url).LocalPath -Leaf There is an open feature request to have To safely download a file with a specific name use Here is a local example with my own webserver just returning a simple txt file - hosts: SERVER2022
gather_facts: false
tasks:
- name: clear temp folder 1
ansible.windows.win_file:
path: C:\temp\test
state: '{{ item }}'
loop:
- absent
- directory
- name: download file with dest as dir
ansible.windows.win_get_url:
url: https://192.168.56.1:36021/agent-download?filename=19.15-69/Windows/FS/fsagent1915_win_x64.zip
dest: C:\temp\test
validate_certs: false
- name: show dir contents 1
ansible.windows.win_shell: gci C:\temp\test
- name: clear temp folder 2
ansible.windows.win_file:
path: C:\temp\test
state: '{{ item }}'
loop:
- absent
- directory
- name: download file with dest with filename
ansible.windows.win_get_url:
url: https://192.168.56.1:36021/agent-download?filename=19.15-69/Windows/FS/fsagent1915_win_x64.zip
dest: C:\temp\test\fsagent1915_win_x64.zip
validate_certs: false
- name: show dir contents 2
ansible.windows.win_shell: gci C:\temp\test The output from this is
|
Thank you. That does seem to have worked. |
SUMMARY
URLs containing parameters fail to download properly. Only the part before the parameter gets downloaded..
ISSUE TYPE
COMPONENT NAME
win_get_url
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Target OS version:
Microsoft Windows Server 2022
Version 21H2 (OS Build 20348.2159)
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
File downloaded to temp directory is:
"C:\\Users\\ansible\\AppData\\Local\\Temp\\ansible.uoatn0ln.3aw\\agent-download"
The text was updated successfully, but these errors were encountered: