Skip to content

New from URL doesn't consider filename (from "Content-Disposition" header) #1198

Closed

Description

@RandolfCarter

Expected behaviour

When using the New->From url feature, ownCloud should consider any Content-Disposition headers it gets when retrieving that URL and use the filename given within that header. Only as a fallback (if no such filename header is given), ownCloud should consider taking part of the URL as name.

Actual behaviour

ownCloud determines the name of the resulting file by taking the last part of the URL (everything after the last /).

Steps to reproduce

  1. Create a php file, e.g. "dl.php":
<?php
header('Content-Disposition: attachment; filename="test.txt"');
header('Content-Type: text/plain');
echo("This is the test text content\n");
  1. Put that php on some server
  2. in owncloudNew->From url choose the URL for the php created in step 1 (i.e. http://example.com/dl.php)
  3. After upload has finished, in the file view, you will see a new file called "dl.php"

Server configuration

Operating system: Ubuntu Server 12.04 LTS 64 bit
Web server: Apache 2.2.22
Database: MySQL Ver 14.14 Distrib 5.5.28
PHP version: 5.3.10
ownCloud version: 4.5.5

Client configuration

Browser: Firefox 18.0
Operating system: Windows 7

Activity

  1. Happyfeet01 commented on Jan 17, 2013

    @Happyfeet01

    i have it reproduce.. it´s the same at the PC it would download a text file. at owncloud dl.php

  2. MTGap commented on Jan 19, 2013

    @MTGap
    Contributor

    Sounds like a good opportunity for a junior job. This needs to be done in: https://github.com/owncloud/core/blob/master/apps/files/ajax/newfile.php

    To get the Content-Disposition header, we'll need to switch over to using cURL to download the file.

  3. houqp commented on Jan 25, 2013

    @houqp
    Contributor

    Hi all,

    I am trying to fix this bug.

    But I am not sure how to handle HTTPS request, I have to set curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); in order to correctly get header for SSL connection. Is that a correct fix?

  4. houqp commented on Jan 25, 2013

    @houqp
    Contributor

    OOPs, probably we don't need to do any changes in the backend? Because even though I fixed the backend, and the file is correctly rename on the disk, the frontend will still put the wrong name in the file list. And I have to refresh the page to get the right file name.

    So we still have to parse the header in frontend right? If so, why don't we just put the right filename in the GET request?

  5. houqp commented on Jan 26, 2013

    @houqp
    Contributor

    anyway, my first try for backend fix is here:
    houqp@1234566

  6. Niduroki commented on Aug 4, 2013

    @Niduroki

    @houqp any status update on this?

  7. houqp commented on Aug 6, 2013

    @houqp
    Contributor

    @Kondou-ger , almost forgot about this issue ;p

    The commit I mentioned above fixed the issue on backend. But we need to fix the display on frontend as well.

  8. houqp commented on Aug 6, 2013

    @houqp
    Contributor

    cannot think of a clean way to handle this :(

  9. ghost assigned on Nov 11, 2013
  10. RandolfCarter commented on Jun 2, 2014

    @RandolfCarter
    ContributorAuthor

    Any update on this?

  11. Happyfeet01 commented on Jun 2, 2014

    @Happyfeet01

    Diese Emailadresse wird nicht mehr genutzt, alle Mails gehen an

  12. bantu commented on Jun 2, 2014

    @bantu

    @RandolfCarter I think the ultimate solution to all these issues is to use a proper HTTP client, possibly Guzzle for ownCloud 8.

  13. modified the milestones: , on Jun 24, 2014
  14. MorrisJobke commented on Mar 3, 2015

    @MorrisJobke
    Contributor

    This feature was dropped with #14652

  15. removed this from the backlog milestone on Mar 3, 2015
  16. locked as resolved and limited conversation to collaborators on Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions