Skip to content
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 does not respect content-disposition #591

Closed
aventrax opened this issue Mar 6, 2024 · 1 comment
Closed

win_get_url does not respect content-disposition #591

aventrax opened this issue Mar 6, 2024 · 1 comment

Comments

@aventrax
Copy link

aventrax commented Mar 6, 2024

SUMMARY

Module win_get_url does not respect content-disposition as the builtin module does.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible.windows.win_get_url

ANSIBLE VERSION
ansible [core 2.16.4]
  config file = /home/matteo/.ansible.cfg
  configured module search path = ['/home/matteo/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/python-virtual-envs/ansible/lib/python3.10/site-packages/ansible
  ansible collection location = /home/matteo/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/python-virtual-envs/ansible/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/opt/python-virtual-envs/ansible/bin/python3)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
Collection      Version
--------------- -------
ansible.windows 2.2.0  

# /opt/python-virtual-envs/ansible/lib/python3.10/site-packages/ansible_collections
Collection      Version
--------------- -------
ansible.windows 2.2.0
CONFIGURATION
CONFIG_FILE() = /home/matteo/.ansible.cfg
EDITOR(env: EDITOR) = vim
HOST_KEY_CHECKING(/home/matteo/.ansible.cfg) = False
INVENTORY_ENABLED(/home/matteo/.ansible.cfg) = ['ini', 'yaml', 'community.general.lxd', 'community.vmware.vmware_vm_inventory', 'netbox.netbox.nb_inventory']
OS / ENVIRONMENT

Ubuntu 22.04 LTS / PYthon 3.10

STEPS TO REPRODUCE
---

# LINUX (works as intended)

- hosts: 172.16.8.56
  gather_facts: true
  any_errors_fatal: true

  tasks:

  - name:  Download the file
    ansible.builtin.get_url:
      url: https://dl.pstmn.io/download/latest/linux64
      dest: "/tmp/"
    register: res

  - debug:
      var: res.dest


# WINDOWS (This is the issue)

- hosts: 172.16.11.33
  gather_facts: true
  any_errors_fatal: true

  tasks:

  - name:  Download the file
    ansible.windows.win_get_url:
      url: https://dl.pstmn.io/download/latest/linux64
      dest: "C:\\temp\\"
    register: res

  - debug:
      var: res.dest
...
EXPECTED RESULTS
ok: [172.16.8.56] => {
    "res.dest": "/tmp/postman-linux-x64.tar.gz"
}
ACTUAL RESULTS
TASK [debug] **************************************************************************************************************************************************************************************************************************
ok: [172.16.11.33] => {
    "res.dest": "C:\\temp\\linux64"
}

Where the HTTP header Content-Disposition is taken:

$ curl -I https://dl.pstmn.io/download/latest/linux64
HTTP/2 200 
content-length: 140108222
date: Tue, 05 Mar 2024 08:36:39 GMT
last-modified: Tue, 05 Mar 2024 08:19:16 GMT
etag: "1180f3f9f07dd2c9774b2f30494ae630-27"
x-amz-server-side-encryption: AES256
accept-ranges: bytes
server: AmazonS3
content-disposition: attachment; filename=postman-linux-x64.tar.gz
cache-control: max-age=604800, s-maxage=604800
x-cache: Hit from cloudfront
via: 1.1 a492d514787de63e7daf0f07b0c799fe.cloudfront.net (CloudFront)
x-amz-cf-pop: MXP64-C1
x-amz-cf-id: yLWNHvlm4ngqOXD9QuBZNXNIKcTmWX--uydsSq8RW5QuJQ-9O5qLjQ==
age: 105402


@jborean93
Copy link
Collaborator

Thanks for the issue, as this is a duplicate of #456 I am going to close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants