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

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

Closed
RandolfCarter opened this issue Jan 16, 2013 · 12 comments
Closed
Assignees
Labels

Comments

@RandolfCarter
Copy link
Contributor

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

@Happyfeet01
Copy link

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

@MTGap
Copy link
Contributor

MTGap commented Jan 19, 2013

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.

@houqp
Copy link
Contributor

houqp commented Jan 25, 2013

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?

@houqp
Copy link
Contributor

houqp commented Jan 25, 2013

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?

@houqp
Copy link
Contributor

houqp commented Jan 26, 2013

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

@Niduroki
Copy link
Member

Niduroki commented Aug 4, 2013

@houqp any status update on this?

@houqp
Copy link
Contributor

houqp commented Aug 6, 2013

@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.

@houqp
Copy link
Contributor

houqp commented Aug 6, 2013

cannot think of a clean way to handle this :(

@RandolfCarter
Copy link
Contributor Author

Any update on this?

@Happyfeet01
Copy link

Diese Emailadresse wird nicht mehr genutzt, alle Mails gehen an

@bantu
Copy link

bantu commented Jun 2, 2014

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

@craigpg craigpg modified the milestones: Backlog, ownCloud 7 Jun 24, 2014
@MorrisJobke
Copy link
Contributor

This feature was dropped with #14652

@MorrisJobke MorrisJobke removed this from the backlog milestone Mar 3, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants