Index: sites/all/modules/private_upload/private_upload.module =================================================================== --- sites/all/modules/private_upload/private_upload.module (revision 2728) +++ sites/all/modules/private_upload/private_upload.module (working copy) @@ -745,18 +745,23 @@ * Create a URL for the file that changes if the file is public or private. * TODO - Push to get a file_create_url hook into Drupal7. * * @param file object $file * @return str: the correct URL */ function _private_upload_create_url($file) { + global $conf; if (_private_upload_is_file_private($file->filepath)) { $download_method = variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC); // this should be PUBLIC, but don't break misconfigured systems - variable_set('file_downloads', FILE_DOWNLOADS_PRIVATE); + $conf['file_downloads'] = FILE_DOWNLOADS_PRIVATE; } // 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()))); if (_private_upload_is_file_private($file->filepath)) { - variable_set('file_downloads', $download_method); + $conf['file_downloads'] = $download_method; } return $href; }