weixin_39836063
weixin_39836063
2021-01-09 16:37

ZIP Attachments download with the name of the host

Zip attachments download with the wrong name, it renames the download file to the name of the host used to connect to roundcube (i.e: webmail.yourdomain.com). After downloading you can rename it and the file is a valid zip but it's a bit annoying.

Tested on debian jessie server with Roundcube Webmail 1.4-git

该提问来源于开源项目:roundcube/roundcubemail

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

15条回答

  • weixin_39836063 weixin_39836063 4月前

    How can I get that?

    点赞 评论 复制链接分享
  • weixin_40001309 weixin_40001309 4月前

    Just find the request entry that is created in console when you click the attachment name. Does it work with 1.3? What is the attachment name, does it contain non-ascii characters?

    点赞 评论 复制链接分享
  • weixin_39836063 weixin_39836063 4月前

    On the console I get the error "Failed to load resource: Frame load interrupted https://webmail.mydomain.com/?_task=mail&_mbox=Trash&_uid=1216&_part=1&_download=1&_action=get&_token=CeyREtl34p6s4CptCP0IGc3cg3xAx6NO"

    It doesn't happen in 1.3, just on 1.4-git version

    点赞 评论 复制链接分享
  • weixin_40001309 weixin_40001309 4月前

    That would mean it might be related to the Content-Disposition header changes we did in 1.4. What http server are you using? What PHP version? And really we need to see the response headers.

    点赞 评论 复制链接分享
  • weixin_39972996 weixin_39972996 4月前

    I'm having the same problem. The original filename contains the non-ascii character ã. Apache httpd-2.4.6-45, PHP 5.4.16. Chrome Version 61.0.3163.79 downloads the file with name "download.zip". Safari Version 10.1.2 (12603.3.8) downloads the file with name "{servername}".

    Unfortunately, i don't know how to show the response headers. With the developer tools on both browsers, i see all the requests in the Network tab (including Documents and XHR), but it doesn't capture the click on the attachment (nor using the submenu to download the file). Also tried to call the download link directly, but still no headers are captured.

    If i build my own curl request, like:

    
    curl \
      -v 'https://servername/?_task=mail&_action=get&_mbox=INBOX&_uid=166530&_token=xxx&_part=3' \
      -H 'Pragma: no-cache' \
      -H 'Accept-Encoding: gzip, deflate, br' \
      -H 'Accept-Language: en-US,en;q=0.8,pt-PT;q=0.6,pt;q=0.4'  \
      -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8' \
      -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
      -H 'X-Roundcube-Request: XXX' \
      -H 'Cache-Control: no-cache' \
      -H 'X-Requested-With: XMLHttpRequest' \
      -H 'Cookie: roundcube_sessid=xxx; roundcube_sessauth=yyy-zzz' \
      -H 'Connection: keep-alive' -H 'Referer: ...' --compressed -o foo
    

    the Content-Disposition header is fine:

    
    Content-Disposition: inline; filename*="UTF-8''guia%CC%83o%20MDS.ZIP"
    
    点赞 评论 复制链接分享
  • weixin_39972996 weixin_39972996 4月前

    If hand-debug the function rcube_output.php:download_headers(), i get in both browsers:

    
    Content-Type: application/x-zip-compressed
    Content-Disposition: attachment; filename*="UTF-8''guia%CC%83o%20MDS.ZIP"
    

    So, i really don't understand the reason for Chrome or Safari to change the attachment name. Maybe it has nothing to do with Roundcube?!

    For now, i added the following line before setting the $disposition to force the $filename to only have ASCII chars.

    
    $filename = iconv($params['charset'] ?: $this->charset,'ASCII//TRANSLIT', $filename);
    

    and it works (as expected, returns "guiao MDS.ZIP").

    点赞 评论 复制链接分享
  • weixin_40001309 weixin_40001309 4月前

    , I think it's the double-quotes, could you check if removing double-quotes works? I.e. the result would be filename*=UTF-8''guia%CC%83o%20MDS.ZIP.

    点赞 评论 复制链接分享
  • weixin_39836063 weixin_39836063 4月前

    sorry for not replying, I downgraded to 1.2.3 which works as expected as it is a production server so I cannot test it anymore. I hope can help.

    点赞 评论 复制链接分享
  • weixin_39972996 weixin_39972996 4月前

    tested #4793ec7 in Chrome, Safari, Firefox and it works fine. It was the double-quotes. Thank you.

    点赞 评论 复制链接分享
  • weixin_40001309 weixin_40001309 4月前

    Fixed.

    点赞 评论 复制链接分享
  • weixin_39836063 weixin_39836063 4月前

    captura de pantalla 2017-07-14 a las 15 20 18

    点赞 评论 复制链接分享
  • weixin_40001309 weixin_40001309 4月前

    You're showing the iframe loading request not the download request. I expect Content-Disposition header there.

    点赞 评论 复制链接分享
  • weixin_40001309 weixin_40001309 4月前

    What browser are you using? Could you check http response headers for the file download request? It may be related to bcc6405552. Works for me.

    点赞 评论 复制链接分享
  • weixin_39836063 weixin_39836063 4月前

    In Safari Versión 10.1.1 (12603.2.4) it happens as I described. In Google Chrome Versión 59.0.3071.115 the file is downloaded as "descarga.zip", I'd rather if it is downloaded with the original name, but at least it is a zip file. In Firefox 54.0.1 (64-bit) it works as expected, the attachment is created with its original name and extension.

    Debugging in Safari Technology Preview and I get:

    1. javascript error "Failed to load resource: Frame load interrupted"

    2. XHRs: {"action":"refresh","unlock":"loading1500037675801","exec":"this.set_unread_count(\"INBOX\",0,true,\"\");\n"}

    3. Request Headers: Name: Value Referer: https://webmail.mydomain.com/?_task=mail&_caps=pdf%3D1%2Cflash%3D0%2Ctiff%3D1%2Cwebp%3D0&_uid=1115&_mbox=INBOX&_action=show&_token=XGD0z02TYw5xoeXTkkK47anJ62E55C9p Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Origin: https://webmail.mydomain.com Host: webmail.mydomain.com Pragma: no-cache Accept: application/json, text/javascript, /; q=0.01 Cache-Control: no-cache Accept-Encoding: gzip, deflate Accept-Language: es-es DNT: 1 Connection: keep-alive Cookie: roundcube_sessauth=PYxp2mYma0ufi7mbsJoR3CC5zj-1500037500; roundcube_sessid=hcb1ie72pebb11jkppa8oefv21 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/604.1.25 (KHTML, like Gecko) Version/11.0 Safari/604.1.25 Content-Length: 81 X-Roundcube-Request: XGD0z02TYw5xoeXTkkK47anJ62E55C9p X-Requested-With: XMLHttpRequest

    4. Response Headers Connection: Keep-Alive X-DNS-Prefetch-Control: off Server: Apache/2.4.10 (Debian) Set-Cookie: roundcube_sessauth=PYxp2mYma0ufi7mbsJoR3CC5zj-1500037800; path=/; secure; httponly Content-Length: 124 Expires: Fri, 14 Jul 2017 13:10:55 GMT Vary: Accept-Encoding X-Frame-Options: sameorigin Content-Encoding: gzip Cache-Control: private, no-cache, no-store, must-revalidate, post-check=0, pre-check=0 Content-Type: text/plain; charset=UTF-8 Pragma: no-cache Date: Fri, 14 Jul 2017 13:10:55 GMT Last-Modified: Fri, 14 Jul 2017 13:10:55 GMT Keep-Alive: timeout=5, max=100

    点赞 评论 复制链接分享
  • weixin_40001309 weixin_40001309 4月前

    These headers are not from the download request.

    点赞 评论 复制链接分享

相关推荐