summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-10-17 09:07:18 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2011-10-17 09:07:18 -0700
commit79346644a3e844076d36cec7132c501a2cd0f02c (patch)
tree4f3cbb3e1744c427df730491505ef44089d9c5a7 /modules
parent5c9eab059c290098b6114a67559d8c7d9b5d3a16 (diff)
downloadbrdo-79346644a3e844076d36cec7132c501a2cd0f02c.tar.gz
brdo-79346644a3e844076d36cec7132c501a2cd0f02c.tar.bz2
Issue #943924 by Merco, lotyrin, eojthebrave: Fixed Allow preview of private image on node add form.
Diffstat (limited to 'modules')
-rw-r--r--modules/file/file.module12
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/file/file.module b/modules/file/file.module
index 4fc998501..9fcdfe071 100644
--- a/modules/file/file.module
+++ b/modules/file/file.module
@@ -142,10 +142,14 @@ function file_file_download($uri, $field_type = 'file') {
// Find out which (if any) fields of this type contain the file.
$references = file_get_file_references($file, NULL, FIELD_LOAD_CURRENT, $field_type);
- // If there are no references, stop processing, to avoid returning headers
- // for files controlled by other modules.
- if (empty($references)) {
- return;
+ // Stop processing if there are no references in order to avoid returning
+ // headers for files controlled by other modules. Make an exception for
+ // temporary files where the host entity has not yet been saved (for example,
+ // an image preview on a node/add form) in which case, allow download by the
+ // file's owner.
+
+ if(empty($references) && ($file->status == FILE_STATUS_PERMANENT || $file->uid != $user->uid)) {
+ return;
}
// Default to allow access.