summaryrefslogtreecommitdiff
path: root/modules/upload
diff options
context:
space:
mode:
authorGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-03-29 06:49:25 +0000
committerGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-03-29 06:49:25 +0000
commit4797222c13e31d49ef389d4cdb2ca30290d341db (patch)
tree924c6ce3f4160f4a37d68589fa2dafd469633e49 /modules/upload
parent8447307ed22f756779bd39a8e38a9ae19632ccb6 (diff)
downloadbrdo-4797222c13e31d49ef389d4cdb2ca30290d341db.tar.gz
brdo-4797222c13e31d49ef389d4cdb2ca30290d341db.tar.bz2
#55520, upload.module does not display previews for when private files are enabled, patch by dopry.
Diffstat (limited to 'modules/upload')
-rw-r--r--modules/upload/upload.module9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index 000c5ae15..d55afb6b2 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -79,6 +79,15 @@ function upload_menu($may_cache) {
if ($_SESSION['file_previews']) {
foreach ($_SESSION['file_previews'] as $fid => $file) {
$filename = file_create_filename($file->filename, file_create_path());
+ if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) {
+ // strip file_directory_path() from filepath
+ // to hide relative paths in url. see file_create_url
+ if (strpos($filename, file_directory_path()) !== false) {
+ $filename = trim(substr($filename, strlen(file_directory_path())), '\\/');
+ }
+ $filename = 'system/files/' . $filename;
+ }
+
$items[] = array(
'path' => $filename, 'title' => t('file download'),
'callback' => 'upload_download',