← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1823089] Re: modal js code can't handle file download

 

Reviewed:  https://review.opendev.org/649752
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=61ec305e33c54d2a8785a6409d2bb9459e1626c0
Submitter: Zuul
Branch:    master

commit 61ec305e33c54d2a8785a6409d2bb9459e1626c0
Author: Adrian Turjak <adriant@xxxxxxxxxxxxxxx>
Date:   Thu Apr 4 11:19:03 2019 +1300

    Add support to modal.js for file attachments in form response
    
    The non-modal forms handle this fine, but the ajax wrapping in modal.js
    doesn't handle this properly and just appends the file data to the page.
    
    This will correctly process the file, and download it before closing the
    modal.
    
    Change-Id: I57dc3212b0658e6061b7524c09f8034792f7ed7b
    Closes-bug: #1823089


** Changed in: horizon
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1823089

Title:
  modal js code can't handle file download

Status in OpenStack Dashboard (Horizon):
  Fix Released

Bug description:
  The modal js code doesn't know how to process and handle when the
  response data is a file attachment. What it does is append the data
  from the file to the modal_wrapper.

  My reason for hitting this is that I have a form which asks for some
  information, and then the handle function returns a file.

  ```
      content = render_to_string(
          template, context, request=request)
      content = '\n'.join([line for line in content.split('\n')
                           if line.strip()])
      response = http.HttpResponse(
          content, content_type="text/plain")

      filename = 'openstack_backup_codes.txt'
      disposition = 'attachment; filename=%s' % filename
      response['Content-Disposition'] = disposition.encode(
          'utf-8')
      response['Content-Length'] = str(len(response.content))
      return response
  ```

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1823089/+subscriptions


References