You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New from URL doesn't consider filename (from "Content-Disposition" header) #1198
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
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");
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
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?
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?
Activity
Happyfeet01 commentedon Jan 17, 2013
i have it reproduce.. it´s the same at the PC it would download a text file. at owncloud dl.php
MTGap commentedon 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 commentedon 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 commentedon 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 commentedon Jan 26, 2013
anyway, my first try for backend fix is here:
houqp@1234566
Niduroki commentedon Aug 4, 2013
@houqp any status update on this?
houqp commentedon 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 commentedon Aug 6, 2013
cannot think of a clean way to handle this :(
RandolfCarter commentedon Jun 2, 2014
Any update on this?
Happyfeet01 commentedon Jun 2, 2014
Diese Emailadresse wird nicht mehr genutzt, alle Mails gehen an
bantu commentedon 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.
MorrisJobke commentedon Mar 3, 2015
This feature was dropped with #14652