I spend today testing og_files module. I must admit that I very like idea of giving groups file repository. The only problem is lots of bugs in this module ;)

For now I think that I found 2 bugs in og_files_file_download function. Here is modified code for this finction:

function og_files_file_download($file) {
  global $user;

  // Should only check files from 'og_files' dir. This is needed when drupal file system is 
  // set to private then accessing files from /files dir is not possible because this function
  // returns -1.
  if (strpos($file, '/og_files/') === FALSE)
  return;

  // f.filepath = '%d' should be f.filepath = '%s'
  if(($user->uid != 1) && !db_result(db_query("SELECT o.uid FROM {og_uid} o, {files} f WHERE f.filepath = '%s' AND f.nid = o.nid AND o.uid = '%d' LIMIT 1",$file,$user->uid))) {
    return -1;
  }
}

Can somebody check are this changes worth of something?

Comments

nath’s picture

Yes, that code fixes the bug. Should get in as soon as possible.

pivica’s picture

Thanks nath. Can you please check http://drupal.org/node/212572 I have created patch that fix this 2 and 3 new bugs that I found today. With all corrected bugs it seems that og_files is ready for daily use, at least on my local comp ;)

pivica’s picture

Status: Needs review » Closed (fixed)
pivica’s picture

Status: Closed (fixed) » Closed (duplicate)