diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-03-06 16:43:10 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-03-06 16:43:10 +0000 |
commit | 5fdaa818dac38274fcf67b8ed45fe0e54bd5da6e (patch) | |
tree | 30221b6e4fa2f7fdd2ddb914e6a5c6d1fb7dd661 /modules/upload | |
parent | afb4242ad1d9328de51a2ff1579b7d62a9aeb747 (diff) | |
download | brdo-5fdaa818dac38274fcf67b8ed45fe0e54bd5da6e.tar.gz brdo-5fdaa818dac38274fcf67b8ed45fe0e54bd5da6e.tar.bz2 |
- Patch #68690 by mindless: new attachments not shown.
Diffstat (limited to 'modules/upload')
-rw-r--r-- | modules/upload/upload.module | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/upload/upload.module b/modules/upload/upload.module index 82c7eb6d9..bd0d5568b 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -577,8 +577,10 @@ function theme_upload_attachments($files) { $header = array(t('Attachment'), t('Size')); $rows = array(); foreach ($files as $file) { - if ($file->list) { - $href = $file->fid ? file_create_url($file->filepath) : url(file_create_filename($file->filename, file_create_path())); + $file = (object)$file; + if ($file->list && !$file->remove) { + // Generate valid URL for both existing attachments and preview of new attachments (these have 'upload' in fid) + $href = file_create_url((strpos($file->fid, 'upload') === FALSE ? $file->filepath : file_create_filename($file->filename, file_create_path()))); $text = $file->description ? $file->description : $file->filename; $rows[] = array(l($text, $href), format_size($file->filesize)); } @@ -766,6 +768,7 @@ function _upload_form($node) { $form['files']['#theme'] = 'upload_form_current'; $form['files']['#tree'] = TRUE; foreach ($node->files as $key => $file) { + // Generate valid URL for both existing attachments and preview of new attachments (these have 'upload' in fid) $description = file_create_url((strpos($file->fid, 'upload') === FALSE ? $file->filepath : file_create_filename($file->filename, file_create_path()))); $description = "<small>". check_plain($description) ."</small>"; $form['files'][$key]['description'] = array('#type' => 'textfield', '#default_value' => (strlen($file->description)) ? $file->description : $file->filename, '#maxlength' => 256, '#description' => $description ); |