? .DS_Store ? .cache ? .cvsignore ? .git ? .project ? .settings ? clean.patch ? hook_file_17.patch ? test ? upload_203204.patch ? upload_multiple_nodes2.diff ? modules/.DS_Store ? modules/simpletest/.DS_Store ? sites/all/modules ? sites/default/files ? sites/default/settings.php ? sites/default/test Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.139 diff -u -p -r1.139 file.inc --- includes/file.inc 12 Oct 2008 04:30:05 -0000 1.139 +++ includes/file.inc 13 Oct 2008 01:00:11 -0000 @@ -896,6 +896,11 @@ function file_save_upload($source, $vali return FALSE; } + // Give everyone read access so that FTP'd users or non-webserver users + // can see/read these files, and give group write permissions so group + // members can alter files uploaded by the webserver. + @chmod($file->filepath, 0664); + // If we made it this far it's safe to record this file in the database. if ($file = file_save($file)) { // Add file to the cache. Index: modules/simpletest/tests/file.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/file.test,v retrieving revision 1.7 diff -u -p -r1.7 file.test --- modules/simpletest/tests/file.test 12 Oct 2008 06:37:40 -0000 1.7 +++ modules/simpletest/tests/file.test 13 Oct 2008 01:00:11 -0000 @@ -358,6 +358,7 @@ class FileSaveUploadTest extends FileHoo $this->drupalLogin($upload_user); $image = current($this->drupalGetTestFiles('image')); + $contents = file_get_contents(realpath($image->filename)); $this->assertTrue(is_file($image->filename), t("The file we're going to upload exists.")); $edit = array('files[file_test_upload]' => realpath($image->filename)); $this->drupalPost('file-test/upload', $edit, t('Submit')); @@ -369,7 +370,10 @@ class FileSaveUploadTest extends FileHoo $max_fid_after = db_result(db_query('SELECT MAX(fid) AS fid FROM {files}')); $this->assertTrue($max_fid_after > $max_fid_before, t('A new file was created.')); - $this->assertTrue(file_load($max_fid_after), t('Loaded the file.')); + $file = file_load($max_fid_after); + $this->assertTrue($file, t('Loaded the file.')); + $this->assertEqual($contents, file_get_contents(realpath($file->filepath)), t('Contents of the file are correct.')); + $this->assertFilePermissions($file->filepath, 0664); } }