diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/upload.module | 9 | ||||
-rw-r--r-- | modules/upload/upload.module | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/modules/upload.module b/modules/upload.module index 000c5ae15..d55afb6b2 100644 --- a/modules/upload.module +++ b/modules/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', 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', |