Private Uploads + Space in filenames

Syn- - May 27, 2005 - 19:24
Project:upload (simple)
Version:HEAD
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

When setting 'Download Method' to private under "File System Settings" uploading a file with spaces in the file name works, however when you try to download the file it errors that it can not find it.

Setting it to public works fine with spaces in the filename. Also, changing the spaces to underscores in the file and uploading it like that shows that the spaces are the problem.

After the holiday weekend if noone checks into this I will.

#1

Veggieryan - June 8, 2006 - 10:56

Im getting this too on 4.7.2... major bummer

#2

jasoncd - August 9, 2006 - 22:22

I'm running 4.7.3 with php5 on IIS. I am not having this problem. I didn't have this problem with 4.6.x and php4 either.
HOWEVER... :)

I'm having a problem with Firefox where the downloaded file loses everything after the first space. I just 'fixed' this by doing the following using the following mozillazine guidance:
http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download

upload.module - line 124

Change from:
'Content-Disposition: '. $disposition .'; filename='. $name
to:
'Content-Disposition: '. $disposition ."; filename=\"". $name ."\"");

Comments?

#3

jonathan_hunt - March 15, 2007 - 23:35

I ran into this problem on Drupal 4.6.4. Here's the code I used. I think this is fixed on 4.7.6 because Content-Disposition is no longer sent by file_transfer().

Index: modules/upload.module
===================================================================
--- modules/upload.module       (revision 3046)
+++ modules/upload.module       (working copy)
@@ -195,7 +195,7 @@
         return array(
           'Content-Type: '. $type .'; name='. $name,
           'Content-Length: '. $file->filesize,
-          'Content-Disposition: '. $disposition .'; filename='. $name,
+          'Content-Disposition: '. $disposition .'; filename="'. $name.'"',
          'Expires: 0', 'Pragma: cache', 'Cache-Control: private'
         );
       }

#4

c960657 - October 4, 2008 - 12:36
Status:active» duplicate

Marking as duplicate of #61528: Private files show open/save prompt for PDFs, etc. while public files automatically open inline that was fixed back in 2006.

 
 

Drupal is a registered trademark of Dries Buytaert.