[drupal-devel] [bug] Private downloads aren't working

walkah drupal-devel at drupal.org
Fri Jan 28 16:07:02 UTC 2005

 Project:      Drupal
 Version:      cvs
 Component:    file system
 Category:     bug reports
 Priority:     critical
 Assigned to:  Anonymous
 Reported by:  stefan nagtegaal
 Updated by:   walkah
 Status:       patch
 Attachment:   http://drupal.org/files/issues/upload-4-5.patch (1.36 KB)

here's a version for 4.5 as well ... (where the SQL wasn't broken).


Previous comments:

October 29, 2004 - 04:37 : stefan nagtegaal

The private downloads are not working properly..

How to reproduce:
Goto 'http://www.your-site.com/admin/settings' and set the 'Download
method' to 'Private - files are transferred by Drupal'. Now, you make a
new item (blog/story/page/poll, whatever) and upload an image.
You should use this image inside your post, by doing an '' inside your
post, where $path is the url which is given in the 'Attachments'
form-group on the submission page. (Something like
Then click 'Preview' and do not submit the node!

Now, have a look what we see..
We see that the image inside the post isn't displayed properly. The
image is broken. If we ask the properties of the image it points to the
right location ('system/files?file=$yourfile.ext'), but isn't
If we take a look at the properties of the table under the node
(attached files table with 'Attachement', and 'List') we see that the
attachment is pointing to something like
instead of the private download url..

I'm not sure how to fix this, but I think it's a bug inside function
file_create_url() which could be found inside file.inc.


October 29, 2004 - 04:51 : stefan nagtegaal

Attachment: http://drupal.org/files/issues/upload-and-body.png (19.87 KB)

Screenshot after upload en filling in the body.form


October 29, 2004 - 04:52 : stefan nagtegaal

Attachment: http://drupal.org/files/issues/node-preview-and-image-properties.png (78.18 KB)

Now we are previewing the node with a broken image in it.. See the
properties of the image, which points to another location as the
'metallic.png' hyperlink inside the 'Attachment'-table under the node


October 29, 2004 - 04:54 : stefan nagtegaal

Attachment: http://drupal.org/files/issues/properties-of-metallic-link-in-attachments-table-under-node.png (53.52 KB)

The properties of the 'metallic.png'-link inside the table under the
node preview differs from where the source points us to.. The url
inside the table works, (which is the same as in public_dowloads), but
the url inside the body isn't...


October 29, 2004 - 05:47 : stefan nagtegaal

This bug is also appearing inside drupal 4.5...


January 28, 2005 - 11:04 : walkah

Attachment: http://drupal.org/files/issues/upload-private-files.patch (1.88 KB)

here's a small patch to fix. basically the custom url rewriting (for
when files haven't been yet saved to their final location) wasn't
taking into account FILE_DOWNLOADS_PRIVATE. this fixes that

(oh, and it also fixes an sql error in upload_download as well).

View: http://drupal.org/node/12267
Edit: http://drupal.org/project/comments/add/12267

More information about the drupal-devel mailing list